vona-core 5.1.39 → 5.1.40
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/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/core/context.d.ts.map +1 -1
- package/dist/types/context/contextBase.d.ts +5 -0
- package/dist/types/context/contextBase.d.ts.map +1 -1
- package/dist/types/context/index.d.ts +1 -0
- package/dist/types/context/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/lib/core/context.ts +6 -5
- package/src/types/context/contextBase.ts +6 -0
- package/src/types/context/index.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -2287,16 +2287,18 @@ const contextBase = {
|
|
|
2287
2287
|
if (self.accepts('html', 'text', 'json') === 'json') return true;
|
|
2288
2288
|
return false;
|
|
2289
2289
|
},
|
|
2290
|
-
redirect(url,
|
|
2290
|
+
redirect(url, statusOrOptions) {
|
|
2291
2291
|
const self = cast(this);
|
|
2292
|
+
const options = typeof statusOrOptions === 'number' ? {
|
|
2293
|
+
status: statusOrOptions
|
|
2294
|
+
} : statusOrOptions ?? {};
|
|
2292
2295
|
// checkOrigin
|
|
2293
|
-
if (!url.startsWith('/')) {
|
|
2296
|
+
if (!url.startsWith('/') && !options.trustedExternal) {
|
|
2294
2297
|
const origin = cast(self.app.bean).security.checkOrigin(url, self.host);
|
|
2295
2298
|
if (!origin) self.app.throw(403);
|
|
2296
2299
|
}
|
|
2297
2300
|
// throw
|
|
2298
|
-
status
|
|
2299
|
-
self.app.throw(status, url);
|
|
2301
|
+
self.app.throw(options.status ?? 302, url);
|
|
2300
2302
|
}
|
|
2301
2303
|
};
|
|
2302
2304
|
|