aboutsummaryrefslogtreecommitdiff
path: root/src/js/node/https.ts
blob: 08eb89a01a03cdaa6584dde23eaa690d9b2333d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Hardcoded module "node:https"
import * as http from "node:http";

var {
  Agent,
  Server,
  METHODS,
  STATUS_CODES,
  createServer,
  ServerResponse,
  IncomingMessage,
  maxHeaderSize,
  validateHeaderName,
  validateHeaderValue,
  globalAgent,
} = http;

function request(input, options, cb) {
  if (input && typeof input === "object" && !(input instanceof URL)) {
    input.protocol ??= "https:";
  } else if (typeof options === "object") {
    options.protocol ??= "https:";
  }

  return http.request(input, options, cb);
}

function get(input, options, cb) {
  const req = request(input, options, cb);
  req.end();
  return req;
}

var defaultExport = {
  Agent,
  Server,
  METHODS,
  STATUS_CODES,
  createServer,
  ServerResponse,
  IncomingMessage,
  request,
  get,
  maxHeaderSize,
  validateHeaderName,
  validateHeaderValue,
  globalAgent,
};

export {
  Agent,
  Server,
  METHODS,
  STATUS_CODES,
  createServer,
  ServerResponse,
  IncomingMessage,
  request,
  get,
  maxHeaderSize,
  validateHeaderName,
  validateHeaderValue,
  globalAgent,
};
export default defaultExport;