MCPcopy
hub / github.com/di-sukharev/opencommit / setRequestProps

Method setRequestProps

out/cli.cjs:26396–26420  ·  view source on GitHub ↗
(req, opts)

Source from the content-addressed store, hash-verified

26394 super.addRequest(req, opts);
26395 }
26396 setRequestProps(req, opts) {
26397 const { proxy } = this;
26398 const protocol = opts.secureEndpoint ? "https:" : "http:";
26399 const hostname = req.getHeader("host") || "localhost";
26400 const base = `${protocol}//${hostname}`;
26401 const url2 = new url_1.URL(req.path, base);
26402 if (opts.port !== 80) {
26403 url2.port = String(opts.port);
26404 }
26405 req.path = String(url2);
26406 const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
26407 if (proxy.username || proxy.password) {
26408 const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
26409 headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`;
26410 }
26411 if (!headers["Proxy-Connection"]) {
26412 headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close";
26413 }
26414 for (const name of Object.keys(headers)) {
26415 const value = headers[name];
26416 if (value) {
26417 req.setHeader(name, value);
26418 }
26419 }
26420 }
26421 async connect(req, opts) {
26422 req._header = null;
26423 if (!req.path.includes("://")) {

Callers 2

addRequestMethod · 0.80
connectMethod · 0.80

Calls 4

setHeaderMethod · 0.80
toStringMethod · 0.45
fromMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected