MCPcopy Index your code
hub / github.com/solidjs/solid-start / handleNoJS

Function handleNoJS

packages/start/src/fns/handler.ts:161–197  ·  view source on GitHub ↗
(result: any, request: Request, parsed: any[], thrown?: boolean)

Source from the content-addressed store, hash-verified

159}
160
161function handleNoJS(result: any, request: Request, parsed: any[], thrown?: boolean) {
162 const url = new URL(request.url);
163 const isError = result instanceof Error;
164 let statusCode = 302;
165 let headers: Headers;
166 if (result instanceof Response) {
167 headers = new Headers(result.headers);
168 if (result.headers.has("Location")) {
169 headers.set(
170 `Location`,
171 new URL(result.headers.get("Location")!, url.origin + import.meta.env.BASE_URL).toString(),
172 );
173 statusCode = getExpectedRedirectStatus(result);
174 }
175 } else
176 headers = new Headers({
177 Location: new URL(request.headers.get("referer")!).toString(),
178 });
179 if (result) {
180 headers.append(
181 "Set-Cookie",
182 `flash=${encodeURIComponent(
183 JSON.stringify({
184 url: url.pathname + url.search,
185 result: isError ? result.message : result,
186 thrown: thrown,
187 error: isError,
188 input: [...parsed.slice(0, -1), [...parsed[parsed.length - 1].entries()]],
189 }),
190 )}; Secure; HttpOnly;`,
191 );
192 }
193 return new Response(null, {
194 status: statusCode,
195 headers,
196 });
197}
198
199let App: any;
200export function createSingleFlightHeaders(sourceEvent: FetchEvent) {

Callers 1

handleServerFunctionFunction · 0.85

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…