@adonisjs/http-server 7.2.5 → 7.4.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-FABGS5HW.js} +24 -7
- package/build/chunk-FABGS5HW.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 +18 -20
- package/build/chunk-GCLM3D4C.js.map +0 -1
|
@@ -88,25 +88,29 @@ var BriskRoute = class extends Macroable {
|
|
|
88
88
|
* be used when no custom params are defined.
|
|
89
89
|
*/
|
|
90
90
|
redirect(identifier, params, options) {
|
|
91
|
-
|
|
91
|
+
function redirectsToRoute(ctx) {
|
|
92
92
|
const redirector = ctx.response.redirect();
|
|
93
93
|
if (options?.status) {
|
|
94
94
|
redirector.status(options.status);
|
|
95
95
|
}
|
|
96
96
|
return redirector.toRoute(identifier, params || ctx.params, options);
|
|
97
|
-
}
|
|
97
|
+
}
|
|
98
|
+
Object.defineProperty(redirectsToRoute, "listArgs", { value: identifier, writable: false });
|
|
99
|
+
return this.setHandler(redirectsToRoute);
|
|
98
100
|
}
|
|
99
101
|
/**
|
|
100
102
|
* Redirect request to a fixed URL
|
|
101
103
|
*/
|
|
102
104
|
redirectToPath(url, options) {
|
|
103
|
-
|
|
105
|
+
function redirectsToPath(ctx) {
|
|
104
106
|
const redirector = ctx.response.redirect();
|
|
105
107
|
if (options?.status) {
|
|
106
108
|
redirector.status(options.status);
|
|
107
109
|
}
|
|
108
110
|
return redirector.toPath(url);
|
|
109
|
-
}
|
|
111
|
+
}
|
|
112
|
+
Object.defineProperty(redirectsToPath, "listArgs", { value: url, writable: false });
|
|
113
|
+
return this.setHandler(redirectsToPath);
|
|
110
114
|
}
|
|
111
115
|
};
|
|
112
116
|
|
|
@@ -2117,6 +2121,7 @@ var ResponseStatus = {
|
|
|
2117
2121
|
};
|
|
2118
2122
|
|
|
2119
2123
|
// src/response.ts
|
|
2124
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
2120
2125
|
import etag from "etag";
|
|
2121
2126
|
import vary from "vary";
|
|
2122
2127
|
import fresh2 from "fresh";
|
|
@@ -2339,7 +2344,7 @@ var Response = class extends Macroable6 {
|
|
|
2339
2344
|
* - Buffer
|
|
2340
2345
|
*/
|
|
2341
2346
|
#getDataType(content) {
|
|
2342
|
-
if (
|
|
2347
|
+
if (Buffer2.isBuffer(content)) {
|
|
2343
2348
|
return "buffer";
|
|
2344
2349
|
}
|
|
2345
2350
|
if (content instanceof Date) {
|
|
@@ -2403,7 +2408,8 @@ var Response = class extends Macroable6 {
|
|
|
2403
2408
|
this.#endResponse(null, ResponseStatus.NotModified);
|
|
2404
2409
|
return;
|
|
2405
2410
|
}
|
|
2406
|
-
this.
|
|
2411
|
+
this.setRequestId();
|
|
2412
|
+
this.header("Content-Length", Buffer2.byteLength(content));
|
|
2407
2413
|
if (jsonpCallbackName) {
|
|
2408
2414
|
this.header("X-Content-Type-Options", "nosniff");
|
|
2409
2415
|
this.safeHeader("Content-Type", "text/javascript; charset=utf-8");
|
|
@@ -2683,6 +2689,17 @@ var Response = class extends Macroable6 {
|
|
|
2683
2689
|
this.header("Etag", etag(body, { weak }));
|
|
2684
2690
|
return this;
|
|
2685
2691
|
}
|
|
2692
|
+
/**
|
|
2693
|
+
* Set X-Request-Id header by copying the header value from the request if it exists.
|
|
2694
|
+
*
|
|
2695
|
+
*/
|
|
2696
|
+
setRequestId() {
|
|
2697
|
+
const requestId = this.request.headers["x-request-id"];
|
|
2698
|
+
if (requestId) {
|
|
2699
|
+
this.header("X-Request-Id", requestId);
|
|
2700
|
+
}
|
|
2701
|
+
return this;
|
|
2702
|
+
}
|
|
2686
2703
|
/**
|
|
2687
2704
|
* Returns a boolean telling if the new response etag evaluates same
|
|
2688
2705
|
* as the request header `if-none-match`. In case of `true`, the
|
|
@@ -4549,4 +4566,4 @@ export {
|
|
|
4549
4566
|
Server,
|
|
4550
4567
|
defineConfig
|
|
4551
4568
|
};
|
|
4552
|
-
//# sourceMappingURL=chunk-
|
|
4569
|
+
//# sourceMappingURL=chunk-FABGS5HW.js.map
|