@aomex/web
Advanced tools
Comparing version 0.0.10 to 0.0.11
# @aomex/web | ||
## 0.0.11 | ||
### Patch Changes | ||
- [`d9dc050`](https://github.com/aomex/aomex/commit/d9dc050897367353588c4bb778cbafb7607406ab) Thanks [@geekact](https://github.com/geekact)! - fix(web): don't override content-length in some case | ||
- [`41ae605`](https://github.com/aomex/aomex/commit/41ae6054b2e87c4120f3fcee12302bb3d96f1df3) Thanks [@geekact](https://github.com/geekact)! - feat(web): auto bind onError | ||
- Updated dependencies []: | ||
- @aomex/core@0.0.10 | ||
## 0.0.10 | ||
@@ -4,0 +15,0 @@ |
@@ -331,2 +331,3 @@ // src/override/middleware.ts | ||
}); | ||
this.onError = this.onError.bind(this); | ||
} | ||
@@ -406,4 +407,7 @@ setHeaders(headers) { | ||
if (output === null) { | ||
const isJSON = this.contentType === "application/json"; | ||
if (this._explicitBody) { | ||
this._body = this.findContentType("json") ? String(null) : ""; | ||
this._body = isJSON ? String(null) : ""; | ||
} else if (isJSON) { | ||
this._body = String(null); | ||
} else { | ||
@@ -539,9 +543,15 @@ this._body = String(this.statusMessage || this.statusCode); | ||
this.removeHeaders("Content-Type", "Content-Length", "Transfer-Encoding"); | ||
} else if (this.contentType === "application/json") { | ||
this.contentLength = Buffer.byteLength(String(null)); | ||
} else if (this._explicitBody) { | ||
this.contentLength = 0; | ||
if (!this.hasHeader("Content-Type")) { | ||
this.contentType = "text"; | ||
if (this.contentType === "application/json") { | ||
this.contentLength = Buffer.byteLength(String(null)); | ||
} else { | ||
this.contentLength = 0; | ||
if (!this.hasHeader("Content-Type")) { | ||
this.contentType = "text"; | ||
} | ||
} | ||
} else if (this.contentType === "application/json") { | ||
if (!this.hasHeader("Content-Length")) { | ||
this.contentLength = Buffer.byteLength(String(null)); | ||
} | ||
} else { | ||
@@ -580,3 +590,3 @@ } | ||
return (req, res) => { | ||
return fn(new WebContext(this, req, res)).then(res.flush.bind(res)).catch(res.onError.bind(res)); | ||
return fn(new WebContext(this, req, res)).then(res.flush.bind(res)).catch(res.onError); | ||
}; | ||
@@ -583,0 +593,0 @@ } |
{ | ||
"name": "@aomex/web", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "", | ||
@@ -29,3 +29,3 @@ "type": "module", | ||
"peerDependencies": { | ||
"@aomex/core": "^0.0.9" | ||
"@aomex/core": "^0.0.10" | ||
}, | ||
@@ -62,3 +62,3 @@ "dependencies": { | ||
"devDependencies": { | ||
"@aomex/core": "^0.0.9", | ||
"@aomex/core": "^0.0.10", | ||
"@types/co-body": "^6.1.0", | ||
@@ -65,0 +65,0 @@ "@types/content-type": "^1.1.5", |
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
93674
1173