Skip to content

Commit

Permalink
revert possible breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico committed Oct 11, 2024
1 parent ada0ae6 commit 289a5aa
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/astro/src/core/middleware/sequence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { APIContext, MiddlewareHandler, RewritePayload } from '../../@types
import { AstroCookies } from '../cookies/cookies.js';
import { apiContextRoutesSymbol } from '../render-context.js';
import { type Pipeline, getParams } from '../render/index.js';
import { copyRequest } from '../routing/rewrite.js';
import { defineMiddleware } from './index.js';

// From SvelteKit: https://github.com/sveltejs/kit/blob/master/packages/kit/src/exports/hooks/sequence.js
Expand Down Expand Up @@ -37,9 +36,9 @@ export function sequence(...handlers: MiddlewareHandler[]): MiddlewareHandler {
if (payload instanceof Request) {
newRequest = payload;
} else if (payload instanceof URL) {
newRequest = copyRequest(payload, handleContext.request);
newRequest = new Request(payload, handleContext.request);
} else {
newRequest = copyRequest(
newRequest = new Request(
new URL(payload, handleContext.url.origin),
handleContext.request,
);
Expand Down

0 comments on commit 289a5aa

Please sign in to comment.