Comparing version 0.2.2 to 0.2.3
@@ -8,25 +8,28 @@ import { randomUUID } from 'node:crypto'; | ||
get(target, property) { | ||
return rawResponse.getHeader(property); | ||
return target[property.toLowerCase()]; | ||
}, | ||
set(target, property, newValue) { | ||
if (!newValue && rawResponse.hasHeader(property)) { | ||
rawResponse.removeHeader(property); | ||
const lowerProperty = property.toLowerCase(); | ||
if (!newValue && rawResponse.hasHeader(lowerProperty)) { | ||
rawResponse.removeHeader(lowerProperty); | ||
delete target[lowerProperty]; | ||
} | ||
else if (newValue) { | ||
rawResponse.setHeader(property, newValue); | ||
rawResponse.setHeader(lowerProperty, newValue); | ||
target[lowerProperty] = rawResponse.getHeader(lowerProperty); | ||
} | ||
target[property] = newValue; | ||
return true; | ||
}, | ||
ownKeys() { | ||
return rawResponse.getHeaderNames(); | ||
ownKeys(target) { | ||
return Object.keys(target); | ||
}, | ||
has(target, p) { | ||
return rawResponse.hasHeader(p); | ||
return rawResponse.hasHeader(p) ?? p.toLowerCase() in target; | ||
}, | ||
deleteProperty(target, p) { | ||
if (rawResponse.hasHeader(p)) { | ||
rawResponse.removeHeader(p); | ||
const lowerProperty = p.toLowerCase(); | ||
if (rawResponse.hasHeader(lowerProperty)) { | ||
rawResponse.removeHeader(lowerProperty); | ||
} | ||
return true; | ||
return delete target[lowerProperty]; | ||
}, | ||
@@ -37,5 +40,4 @@ }); | ||
Object.defineProperty(res, 'headers', { | ||
get() { | ||
return headers; | ||
}, | ||
value: headers, | ||
writable: false, | ||
enumerable: true, | ||
@@ -168,3 +170,3 @@ }); | ||
if (this.httpVersion == '1.1') { | ||
this.rawResponse.writeHead(this._status); | ||
this.rawResponse.writeHead(this._status, { ...this.headers }); | ||
} | ||
@@ -171,0 +173,0 @@ else { |
{ | ||
"name": "fluvial", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Fluvial: A light http/2 server framework, similar to Express", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
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
105328
1299