Skip to content

Commit 27fbb08

Browse files
committed
Keep GET method for loader requests
1 parent f3541dd commit 27fbb08

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

packages/router/__tests__/router-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10956,11 +10956,11 @@ describe("a router", () => {
1095610956
let rootLoaderRequest = rootLoaderStub.mock.calls[0][0]?.request;
1095710957
// @ts-expect-error
1095810958
let childLoaderRequest = childLoaderStub.mock.calls[0][0]?.request;
10959-
expect(rootLoaderRequest.method).toBe("POST");
10959+
expect(rootLoaderRequest.method).toBe("GET");
1096010960
expect(rootLoaderRequest.url).toBe("http://localhost/child");
1096110961
expect(rootLoaderRequest.headers.get("test")).toBe("value");
1096210962
expect(await rootLoaderRequest.text()).toBe("");
10963-
expect(childLoaderRequest.method).toBe("POST");
10963+
expect(childLoaderRequest.method).toBe("GET");
1096410964
expect(childLoaderRequest.url).toBe("http://localhost/child");
1096510965
expect(childLoaderRequest.headers.get("test")).toBe("value");
1096610966
// Can't re-read body here since it's the same request as the root

packages/router/router.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,11 +2256,9 @@ export function unstable_createStaticHandler(
22562256
};
22572257
}
22582258

2259-
// Create a request for the loaders
2259+
// Create a GET request for the loaders
22602260
let loaderRequest = new Request(request.url, {
2261-
body: null,
22622261
headers: request.headers,
2263-
method: request.method,
22642262
redirect: request.redirect,
22652263
signal: request.signal,
22662264
});

0 commit comments

Comments
 (0)