MCPcopy Index your code
hub / github.com/anomalyco/opencode / redirect

Function redirect

packages/web/src/middleware.ts:26–37  ·  view source on GitHub ↗
(url: URL, path: string, locale?: string)

Source from the content-addressed store, hash-verified

24}
25
26function redirect(url: URL, path: string, locale?: string) {
27 const next = new URL(url.toString())
28 next.pathname = path
29 const headers = new Headers({
30 Location: next.toString(),
31 })
32 if (locale) headers.set("Set-Cookie", cookie(locale))
33 return new Response(null, {
34 status: 302,
35 headers,
36 })
37}
38
39function localeFromCookie(header: string | null) {
40 if (!header) return null

Callers 10

GETFunction · 0.85
GETFunction · 0.85
GETFunction · 0.85
GETFunction · 0.85
GETFunction · 0.85
GETFunction · 0.85
[plan].tsxFile · 0.85
getActorFunction · 0.85
middleware.tsFile · 0.85

Calls 2

cookieFunction · 0.70
setMethod · 0.45

Tested by

no test coverage detected