@hono/node-server
Advanced tools
Comparing version 1.4.1 to 1.5.0
@@ -43,9 +43,13 @@ "use strict"; | ||
// src/request.ts | ||
var import_node_path = require("path"); | ||
var import_node_http2 = require("http2"); | ||
var import_node_stream = require("stream"); | ||
var newRequestFromIncoming = (method, url, incoming) => { | ||
const headerRecord = []; | ||
const len = incoming.rawHeaders.length; | ||
for (let i = 0; i < len; i += 2) { | ||
headerRecord.push([incoming.rawHeaders[i], incoming.rawHeaders[i + 1]]); | ||
const rawHeaders = incoming.rawHeaders; | ||
for (let i = 0; i < rawHeaders.length; i += 2) { | ||
const { [i]: key, [i + 1]: value } = rawHeaders; | ||
if (key.charCodeAt(0) !== /*:*/ | ||
58) { | ||
headerRecord.push([key, value]); | ||
} | ||
} | ||
@@ -65,2 +69,3 @@ const init = { | ||
var incomingKey = Symbol("incomingKey"); | ||
var urlKey = Symbol("urlKey"); | ||
var requestPrototype = { | ||
@@ -71,12 +76,10 @@ get method() { | ||
get url() { | ||
let path = this[incomingKey]["path"]; | ||
if (!path) { | ||
const originalPath = this[incomingKey].url; | ||
path = /\.\./.test(originalPath) ? (0, import_node_path.resolve)(originalPath) : originalPath; | ||
this[incomingKey]["path"] = path; | ||
} | ||
return `http://${this[incomingKey].headers.host}${path}`; | ||
return this[urlKey]; | ||
}, | ||
[getRequestCache]() { | ||
return this[requestCache] ||= newRequestFromIncoming(this.method, this.url, this[incomingKey]); | ||
return this[requestCache] ||= newRequestFromIncoming( | ||
this.method, | ||
this[urlKey], | ||
this[incomingKey] | ||
); | ||
} | ||
@@ -115,2 +118,5 @@ }; | ||
req[incomingKey] = incoming; | ||
req[urlKey] = new URL( | ||
`http://${incoming instanceof import_node_http2.Http2ServerRequest ? incoming.authority : incoming.headers.host}${incoming.url}` | ||
).href; | ||
return req; | ||
@@ -117,0 +123,0 @@ }; |
@@ -38,9 +38,13 @@ "use strict"; | ||
// src/request.ts | ||
var import_node_path = require("path"); | ||
var import_node_http2 = require("http2"); | ||
var import_node_stream = require("stream"); | ||
var newRequestFromIncoming = (method, url, incoming) => { | ||
const headerRecord = []; | ||
const len = incoming.rawHeaders.length; | ||
for (let i = 0; i < len; i += 2) { | ||
headerRecord.push([incoming.rawHeaders[i], incoming.rawHeaders[i + 1]]); | ||
const rawHeaders = incoming.rawHeaders; | ||
for (let i = 0; i < rawHeaders.length; i += 2) { | ||
const { [i]: key, [i + 1]: value } = rawHeaders; | ||
if (key.charCodeAt(0) !== /*:*/ | ||
58) { | ||
headerRecord.push([key, value]); | ||
} | ||
} | ||
@@ -60,2 +64,3 @@ const init = { | ||
var incomingKey = Symbol("incomingKey"); | ||
var urlKey = Symbol("urlKey"); | ||
var requestPrototype = { | ||
@@ -66,12 +71,10 @@ get method() { | ||
get url() { | ||
let path = this[incomingKey]["path"]; | ||
if (!path) { | ||
const originalPath = this[incomingKey].url; | ||
path = /\.\./.test(originalPath) ? (0, import_node_path.resolve)(originalPath) : originalPath; | ||
this[incomingKey]["path"] = path; | ||
} | ||
return `http://${this[incomingKey].headers.host}${path}`; | ||
return this[urlKey]; | ||
}, | ||
[getRequestCache]() { | ||
return this[requestCache] ||= newRequestFromIncoming(this.method, this.url, this[incomingKey]); | ||
return this[requestCache] ||= newRequestFromIncoming( | ||
this.method, | ||
this[urlKey], | ||
this[incomingKey] | ||
); | ||
} | ||
@@ -110,2 +113,5 @@ }; | ||
req[incomingKey] = incoming; | ||
req[urlKey] = new URL( | ||
`http://${incoming instanceof import_node_http2.Http2ServerRequest ? incoming.authority : incoming.headers.host}${incoming.url}` | ||
).href; | ||
return req; | ||
@@ -112,0 +118,0 @@ }; |
@@ -26,9 +26,13 @@ "use strict"; | ||
module.exports = __toCommonJS(request_exports); | ||
var import_node_path = require("path"); | ||
var import_node_http2 = require("http2"); | ||
var import_node_stream = require("stream"); | ||
var newRequestFromIncoming = (method, url, incoming) => { | ||
const headerRecord = []; | ||
const len = incoming.rawHeaders.length; | ||
for (let i = 0; i < len; i += 2) { | ||
headerRecord.push([incoming.rawHeaders[i], incoming.rawHeaders[i + 1]]); | ||
const rawHeaders = incoming.rawHeaders; | ||
for (let i = 0; i < rawHeaders.length; i += 2) { | ||
const { [i]: key, [i + 1]: value } = rawHeaders; | ||
if (key.charCodeAt(0) !== /*:*/ | ||
58) { | ||
headerRecord.push([key, value]); | ||
} | ||
} | ||
@@ -48,2 +52,3 @@ const init = { | ||
var incomingKey = Symbol("incomingKey"); | ||
var urlKey = Symbol("urlKey"); | ||
var requestPrototype = { | ||
@@ -54,12 +59,10 @@ get method() { | ||
get url() { | ||
let path = this[incomingKey]["path"]; | ||
if (!path) { | ||
const originalPath = this[incomingKey].url; | ||
path = /\.\./.test(originalPath) ? (0, import_node_path.resolve)(originalPath) : originalPath; | ||
this[incomingKey]["path"] = path; | ||
} | ||
return `http://${this[incomingKey].headers.host}${path}`; | ||
return this[urlKey]; | ||
}, | ||
[getRequestCache]() { | ||
return this[requestCache] ||= newRequestFromIncoming(this.method, this.url, this[incomingKey]); | ||
return this[requestCache] ||= newRequestFromIncoming( | ||
this.method, | ||
this[urlKey], | ||
this[incomingKey] | ||
); | ||
} | ||
@@ -98,2 +101,5 @@ }; | ||
req[incomingKey] = incoming; | ||
req[urlKey] = new URL( | ||
`http://${incoming instanceof import_node_http2.Http2ServerRequest ? incoming.authority : incoming.headers.host}${incoming.url}` | ||
).href; | ||
return req; | ||
@@ -100,0 +106,0 @@ }; |
@@ -40,9 +40,13 @@ "use strict"; | ||
// src/request.ts | ||
var import_node_path = require("path"); | ||
var import_node_http2 = require("http2"); | ||
var import_node_stream = require("stream"); | ||
var newRequestFromIncoming = (method, url, incoming) => { | ||
const headerRecord = []; | ||
const len = incoming.rawHeaders.length; | ||
for (let i = 0; i < len; i += 2) { | ||
headerRecord.push([incoming.rawHeaders[i], incoming.rawHeaders[i + 1]]); | ||
const rawHeaders = incoming.rawHeaders; | ||
for (let i = 0; i < rawHeaders.length; i += 2) { | ||
const { [i]: key, [i + 1]: value } = rawHeaders; | ||
if (key.charCodeAt(0) !== /*:*/ | ||
58) { | ||
headerRecord.push([key, value]); | ||
} | ||
} | ||
@@ -62,2 +66,3 @@ const init = { | ||
var incomingKey = Symbol("incomingKey"); | ||
var urlKey = Symbol("urlKey"); | ||
var requestPrototype = { | ||
@@ -68,12 +73,10 @@ get method() { | ||
get url() { | ||
let path = this[incomingKey]["path"]; | ||
if (!path) { | ||
const originalPath = this[incomingKey].url; | ||
path = /\.\./.test(originalPath) ? (0, import_node_path.resolve)(originalPath) : originalPath; | ||
this[incomingKey]["path"] = path; | ||
} | ||
return `http://${this[incomingKey].headers.host}${path}`; | ||
return this[urlKey]; | ||
}, | ||
[getRequestCache]() { | ||
return this[requestCache] ||= newRequestFromIncoming(this.method, this.url, this[incomingKey]); | ||
return this[requestCache] ||= newRequestFromIncoming( | ||
this.method, | ||
this[urlKey], | ||
this[incomingKey] | ||
); | ||
} | ||
@@ -112,2 +115,5 @@ }; | ||
req[incomingKey] = incoming; | ||
req[urlKey] = new URL( | ||
`http://${incoming instanceof import_node_http2.Http2ServerRequest ? incoming.authority : incoming.headers.host}${incoming.url}` | ||
).href; | ||
return req; | ||
@@ -114,0 +120,0 @@ }; |
@@ -38,9 +38,13 @@ "use strict"; | ||
// src/request.ts | ||
var import_node_path = require("path"); | ||
var import_node_http2 = require("http2"); | ||
var import_node_stream = require("stream"); | ||
var newRequestFromIncoming = (method, url, incoming) => { | ||
const headerRecord = []; | ||
const len = incoming.rawHeaders.length; | ||
for (let i = 0; i < len; i += 2) { | ||
headerRecord.push([incoming.rawHeaders[i], incoming.rawHeaders[i + 1]]); | ||
const rawHeaders = incoming.rawHeaders; | ||
for (let i = 0; i < rawHeaders.length; i += 2) { | ||
const { [i]: key, [i + 1]: value } = rawHeaders; | ||
if (key.charCodeAt(0) !== /*:*/ | ||
58) { | ||
headerRecord.push([key, value]); | ||
} | ||
} | ||
@@ -60,2 +64,3 @@ const init = { | ||
var incomingKey = Symbol("incomingKey"); | ||
var urlKey = Symbol("urlKey"); | ||
var requestPrototype = { | ||
@@ -66,12 +71,10 @@ get method() { | ||
get url() { | ||
let path = this[incomingKey]["path"]; | ||
if (!path) { | ||
const originalPath = this[incomingKey].url; | ||
path = /\.\./.test(originalPath) ? (0, import_node_path.resolve)(originalPath) : originalPath; | ||
this[incomingKey]["path"] = path; | ||
} | ||
return `http://${this[incomingKey].headers.host}${path}`; | ||
return this[urlKey]; | ||
}, | ||
[getRequestCache]() { | ||
return this[requestCache] ||= newRequestFromIncoming(this.method, this.url, this[incomingKey]); | ||
return this[requestCache] ||= newRequestFromIncoming( | ||
this.method, | ||
this[urlKey], | ||
this[incomingKey] | ||
); | ||
} | ||
@@ -110,2 +113,5 @@ }; | ||
req[incomingKey] = incoming; | ||
req[urlKey] = new URL( | ||
`http://${incoming instanceof import_node_http2.Http2ServerRequest ? incoming.authority : incoming.headers.host}${incoming.url}` | ||
).href; | ||
return req; | ||
@@ -112,0 +118,0 @@ }; |
{ | ||
"name": "@hono/node-server", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"description": "Node.js Adapter for Hono", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
123599
3892
14