Skip to content

Commit

Permalink
Remove console log
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 committed Jan 16, 2025
1 parent 9b7465a commit d08cbb6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 27 deletions.
47 changes: 22 additions & 25 deletions integration/single-fetch-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1703,34 +1703,31 @@ test.describe("single-fetch", () => {
test("does not try to encode a turbo-stream body into 204 responses", async ({
page,
}) => {
let fixture = await createFixture(
{
files: {
...files,
"app/routes/_index.tsx": js`
import { data, Form, useActionData, useNavigation } from "react-router";
let fixture = await createFixture({
files: {
...files,
"app/routes/_index.tsx": js`
import { data, Form, useActionData, useNavigation } from "react-router";
export async function action({ request }) {
await new Promise(r => setTimeout(r, 500));
return data(null, { status: 204 });
};
export async function action({ request }) {
await new Promise(r => setTimeout(r, 500));
return data(null, { status: 204 });
};
export default function Index() {
const navigation = useNavigation();
const actionData = useActionData();
return (
<Form method="post">
{navigation.state === "idle" ? <p data-idle>idle</p> : <p data-active>active</p>}
<button data-submit type="submit">{actionData ?? 'no content!'}</button>
</Form>
);
}
`,
},
export default function Index() {
const navigation = useNavigation();
const actionData = useActionData();
return (
<Form method="post">
{navigation.state === "idle" ? <p data-idle>idle</p> : <p data-active>active</p>}
<button data-submit type="submit">{actionData ?? 'no content!'}</button>
</Form>
);
}
`,
},
ServerMode.Development
);
let appFixture = await createAppFixture(fixture, ServerMode.Development);
});
let appFixture = await createAppFixture(fixture);

let app = new PlaywrightFixture(appFixture, page);

Expand Down
3 changes: 1 addition & 2 deletions packages/react-router/lib/server-runtime/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,8 @@ async function handleSingleFetchRequest(
// https://datatracker.ietf.org/doc/html/rfc9110#name-204-no-content
// https://datatracker.ietf.org/doc/html/rfc9110#name-205-reset-content
// https://datatracker.ietf.org/doc/html/rfc9110#name-304-not-modified
const NO_BODY_STATUS_CODES = new Set([100, 101, 204, 205, 304]);
let NO_BODY_STATUS_CODES = new Set([100, 101, 204, 205, 304]);
if (NO_BODY_STATUS_CODES.has(status)) {
console.log("returning single fetch response with no body");
return new Response(null, { status, headers: resultHeaders });
}

Expand Down

0 comments on commit d08cbb6

Please sign in to comment.