@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.
@@ -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 is honored as the page render does.
200
- // Use the action's chosen status (307/308) so an explicit redirect()
201
- // keeps its semantics; PRG (303) is the SUCCESS-result path below.
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
- return new Response(null, { status: e.status || 307, headers: { location: e.url } });
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);