@adonisjs/http-server 7.2.5 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/{chunk-GCLM3D4C.js → chunk-2UUPHZPW.js} +16 -3
- package/build/chunk-2UUPHZPW.js.map +1 -0
- package/build/factories/main.js +1 -1
- package/build/index.js +1 -1
- package/build/src/exceptions.d.ts +1 -1
- package/build/src/response.d.ts +7 -1
- package/package.json +16 -18
- package/build/chunk-GCLM3D4C.js.map +0 -1
|
@@ -2117,6 +2117,7 @@ var ResponseStatus = {
|
|
|
2117
2117
|
};
|
|
2118
2118
|
|
|
2119
2119
|
// src/response.ts
|
|
2120
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
2120
2121
|
import etag from "etag";
|
|
2121
2122
|
import vary from "vary";
|
|
2122
2123
|
import fresh2 from "fresh";
|
|
@@ -2339,7 +2340,7 @@ var Response = class extends Macroable6 {
|
|
|
2339
2340
|
* - Buffer
|
|
2340
2341
|
*/
|
|
2341
2342
|
#getDataType(content) {
|
|
2342
|
-
if (
|
|
2343
|
+
if (Buffer2.isBuffer(content)) {
|
|
2343
2344
|
return "buffer";
|
|
2344
2345
|
}
|
|
2345
2346
|
if (content instanceof Date) {
|
|
@@ -2403,7 +2404,8 @@ var Response = class extends Macroable6 {
|
|
|
2403
2404
|
this.#endResponse(null, ResponseStatus.NotModified);
|
|
2404
2405
|
return;
|
|
2405
2406
|
}
|
|
2406
|
-
this.
|
|
2407
|
+
this.setRequestId();
|
|
2408
|
+
this.header("Content-Length", Buffer2.byteLength(content));
|
|
2407
2409
|
if (jsonpCallbackName) {
|
|
2408
2410
|
this.header("X-Content-Type-Options", "nosniff");
|
|
2409
2411
|
this.safeHeader("Content-Type", "text/javascript; charset=utf-8");
|
|
@@ -2683,6 +2685,17 @@ var Response = class extends Macroable6 {
|
|
|
2683
2685
|
this.header("Etag", etag(body, { weak }));
|
|
2684
2686
|
return this;
|
|
2685
2687
|
}
|
|
2688
|
+
/**
|
|
2689
|
+
* Set X-Request-Id header by copying the header value from the request if it exists.
|
|
2690
|
+
*
|
|
2691
|
+
*/
|
|
2692
|
+
setRequestId() {
|
|
2693
|
+
const requestId = this.request.headers["x-request-id"];
|
|
2694
|
+
if (requestId) {
|
|
2695
|
+
this.header("X-Request-Id", requestId);
|
|
2696
|
+
}
|
|
2697
|
+
return this;
|
|
2698
|
+
}
|
|
2686
2699
|
/**
|
|
2687
2700
|
* Returns a boolean telling if the new response etag evaluates same
|
|
2688
2701
|
* as the request header `if-none-match`. In case of `true`, the
|
|
@@ -4549,4 +4562,4 @@ export {
|
|
|
4549
4562
|
Server,
|
|
4550
4563
|
defineConfig
|
|
4551
4564
|
};
|
|
4552
|
-
//# sourceMappingURL=chunk-
|
|
4565
|
+
//# sourceMappingURL=chunk-2UUPHZPW.js.map
|