Skip to content

node: ClientRequest.options.createConnection #19507

@monotter

Description

@monotter
import tls from 'node:tls'
import https from 'node:https'
import net from 'node:net'

function tlsConnect(options) {
  options.path = undefined;

  if (!options.servername && options.servername !== '') {
    options.servername = net.isIP(options.host) ? '' : options.host;
  }

  return tls.connect(options);
}

const opts = {
  protocolVersion: 13,
  maxPayload: 104857600,
  skipUTF8Validation: false,
  perMessageDeflate: true,
  followRedirects: false,
  maxRedirects: 10,
  handshakeTimeout: 30000,
  createConnection: tlsConnect,
  socketPath: undefined,
  hostname: undefined,
  protocol: undefined,
  timeout: 30000,
  method: "GET",
  host: "gateway.discord.gg",
  path: "/?v=10&encoding=json",
  port: 443,
  defaultPort: 443,
  headers: {
    Connection: "Upgrade",
    Upgrade: "websocket",
    "Sec-WebSocket-Extensions": "permessage-deflate; client_max_window_bits"
  }
}

https.request(opts)

I've had an issue on DiscordJS with deno. Whenever I run this code I am getting this issue below.
Ekran Resmi 2023-06-14 21 12 16

Metadata

Metadata

Assignees

Labels

bugSomething isn't working correctlynode APIRelated to various "node:*" modules APIsnode compatnode:httpIssues with `node:http` module - to be fixed with a rewrite

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions