@aomex/web
Advanced tools
Comparing version 1.0.1 to 1.0.2
# @aomex/web | ||
## 1.0.2 | ||
### Patch Changes | ||
- Updated dependencies []: | ||
- @aomex/internal-tools@1.0.2 | ||
## 1.0.1 | ||
@@ -4,0 +11,0 @@ |
@@ -68,4 +68,3 @@ // src/i18n/locales/zh-cn.ts | ||
get body() { | ||
if (this._body) | ||
return Promise.resolve(this._body); | ||
if (this._body) return Promise.resolve(this._body); | ||
if (this.matchContentType("multipart/*") !== null) { | ||
@@ -94,9 +93,6 @@ const form = formidable({ | ||
get fresh() { | ||
if (this.method !== "GET" && this.method !== "HEAD") | ||
return false; | ||
if (this.method !== "GET" && this.method !== "HEAD") return false; | ||
const status = this.res.statusCode; | ||
if (status < 200) | ||
return false; | ||
if (status >= 300 && status !== 304) | ||
return false; | ||
if (status < 200) return false; | ||
if (status >= 300 && status !== 304) return false; | ||
return fresh(this.headers, this.res.getHeaders()); | ||
@@ -130,4 +126,3 @@ } | ||
get protocol() { | ||
if (this.socket.encrypted) | ||
return "https"; | ||
if (this.socket.encrypted) return "https"; | ||
const proto = this.headers["x-forwarded-proto"]; | ||
@@ -243,4 +238,3 @@ return proto && proto.split(/\s*,\s*/, 1)[0] || "http"; | ||
try { | ||
if (!mimeType) | ||
throw new Error(""); | ||
if (!mimeType) throw new Error(""); | ||
contentType2.parse(mimeType); | ||
@@ -270,7 +264,5 @@ } catch { | ||
flush() { | ||
if (!this.writable || this.headersSent) | ||
return; | ||
if (!this.writable || this.headersSent) return; | ||
let output = this.body; | ||
if (statuses.empty[this.statusCode]) | ||
return void this.end(); | ||
if (statuses.empty[this.statusCode]) return void this.end(); | ||
if (output === null) { | ||
@@ -287,8 +279,5 @@ if (this.contentType === "application/json") { | ||
} | ||
if (this.req.method === "HEAD") | ||
return void this.end(); | ||
if (typeof output === "string") | ||
return void this.end(output); | ||
if (Buffer.isBuffer(output)) | ||
return void this.end(output); | ||
if (this.req.method === "HEAD") return void this.end(); | ||
if (typeof output === "string") return void this.end(output); | ||
if (Buffer.isBuffer(output)) return void this.end(output); | ||
if (output instanceof Stream) { | ||
@@ -306,10 +295,6 @@ if (!output.listenerCount("error")) { | ||
isJSON(body2) { | ||
if (!body2) | ||
return false; | ||
if (typeof body2 === "string") | ||
return false; | ||
if (body2 instanceof Stream) | ||
return false; | ||
if (Buffer.isBuffer(body2)) | ||
return false; | ||
if (!body2) return false; | ||
if (typeof body2 === "string") return false; | ||
if (body2 instanceof Stream) return false; | ||
if (Buffer.isBuffer(body2)) return false; | ||
return true; | ||
@@ -322,4 +307,3 @@ } | ||
onError(error) { | ||
if (error == null) | ||
return; | ||
if (error == null) return; | ||
const err = isHttpError(error) ? error : createHttpError(error); | ||
@@ -397,4 +381,3 @@ this.removeHeaders(...this.getHeaderNames()); | ||
updateBodyType() { | ||
if (this._updatingBodyType) | ||
return; | ||
if (this._updatingBodyType) return; | ||
this._updatingBodyType = true; | ||
@@ -511,4 +494,3 @@ const { body: body2 } = this; | ||
log(err, ctx) { | ||
if (ctx.response.statusCode === 404 || err.expose) | ||
return; | ||
if (ctx.response.statusCode === 404 || err.expose) return; | ||
const msgs = (err.stack || err.toString()).split(EOL, 2); | ||
@@ -515,0 +497,0 @@ console.error(["", chalk.bgRed(msgs.shift()), msgs.join(EOL), ""].join(EOL)); |
{ | ||
"name": "@aomex/web", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "aomex web层应用", | ||
@@ -57,3 +57,3 @@ "type": "module", | ||
"vary": "^1.1.2", | ||
"@aomex/internal-tools": "^1.0.1" | ||
"@aomex/internal-tools": "^1.0.2" | ||
}, | ||
@@ -71,5 +71,5 @@ "devDependencies": { | ||
"@types/vary": "^1.1.3", | ||
"@aomex/core": "^1.0.1" | ||
"@aomex/core": "^1.0.2" | ||
}, | ||
"scripts": {} | ||
} |
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
89747
1148
Updated@aomex/internal-tools@^1.0.2