SolidJSS
SolidJSโ€ข3y agoโ€ข
4 replies
stiba

UND_ERR_REQ_CONTENT_LENGTH_MISMATCH error when navigating to index route

My index route looks like this

export function routeData() {
  return createServerData$(async (_, { request, fetch: fetcher }) => {
    const response = await fetcher("http://localhost:4000/api/users/self", {
      ...request,
      credentials: "include",
      headers: request.headers,
    });

    if (response.status !== 200) {
      throw redirect("/login");
    }

    return response.json() as Promise<{ id: string }>;
  });
}

const Root: VoidComponent = () => {
  const data = useRouteData<typeof routeData>();
  return (....)
}
Was this page helpful?