@webjsdev/server 0.8.20 → 0.8.21
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/index.d.ts +111 -5
- package/index.js +5 -0
- package/package.json +1 -1
- package/src/auth.js +7 -0
- package/src/check.js +260 -68
- package/src/module-graph.js +16 -7
- package/src/page-action.js +5 -3
- package/src/ssr.js +6 -1
- package/src/vendor.js +839 -96
package/src/page-action.js
CHANGED
|
@@ -196,9 +196,11 @@ export async function runPageAction(route, params, url, loaded, req, ssrOpts) {
|
|
|
196
196
|
} catch (err) {
|
|
197
197
|
if (isRedirect(err)) {
|
|
198
198
|
const e = /** @type any */ (err);
|
|
199
|
-
// A thrown redirect from an action
|
|
200
|
-
//
|
|
201
|
-
//
|
|
199
|
+
// A thrown redirect from an action (a POST) defaults to 307 Temporary
|
|
200
|
+
// Redirect, which is method-preserving so the action's intent survives
|
|
201
|
+
// the bounce; an explicit `redirect(url, status)` overrides it. This is
|
|
202
|
+
// deliberately NOT the GET gate's 302 default (see ssr.js). PRG (303) is
|
|
203
|
+
// the SUCCESS-result path below.
|
|
202
204
|
return new Response(null, { status: e.status || 307, headers: { location: e.url } });
|
|
203
205
|
}
|
|
204
206
|
if (isNotFound(err)) {
|
package/src/ssr.js
CHANGED
|
@@ -198,7 +198,12 @@ export async function ssrPage(route, params, url, opts) {
|
|
|
198
198
|
} catch (err) {
|
|
199
199
|
if (isRedirect(err)) {
|
|
200
200
|
const e = /** @type any */ (err);
|
|
201
|
-
|
|
201
|
+
// A redirect thrown during a GET page/layout render is a GET-to-GET
|
|
202
|
+
// navigation (an auth bounce, a gate). 302 Found is the conventional
|
|
203
|
+
// code there, so it is the default when the caller did not pick one. An
|
|
204
|
+
// explicit `redirect(url, status)` overrides it. (Action redirects, a
|
|
205
|
+
// POST, default to 307 in page-action.js so the method is preserved.)
|
|
206
|
+
return new Response(null, { status: e.status || 302, headers: { location: e.url } });
|
|
202
207
|
}
|
|
203
208
|
if (isNotFound(err)) {
|
|
204
209
|
const html = await ssrNotFoundHtml(null, opts);
|