S
SolidJS11mo ago
sh1man

[h3] [unhandled] H3Error: Missing "./runtime/http-types" specifier in "vinxi" package

import type {FetchEvent} from "@solidjs/start/server/types";
import {getHeader, setResponseStatus} from "vinxi/runtime/http-types";
export const cors = async (event: FetchEvent) => {
if (event.request.method !== "GET") {
const originHeader = getHeader(event, "Origin") ?? null;
const hostHeader = getHeader(event, "Host") ?? null;
if (!originHeader || !hostHeader || !verifyRequestOrigin(originHeader, [hostHeader])) {
setResponseStatus(
403,
"Forbidden: Origin is not allowed."
)
return ;
}
}
}
import type {FetchEvent} from "@solidjs/start/server/types";
import {getHeader, setResponseStatus} from "vinxi/runtime/http-types";
export const cors = async (event: FetchEvent) => {
if (event.request.method !== "GET") {
const originHeader = getHeader(event, "Origin") ?? null;
const hostHeader = getHeader(event, "Host") ?? null;
if (!originHeader || !hostHeader || !verifyRequestOrigin(originHeader, [hostHeader])) {
setResponseStatus(
403,
"Forbidden: Origin is not allowed."
)
return ;
}
}
}
2 Replies
Brendonovich
Brendonovich11mo ago
import from vinxi/http
sh1man
sh1manOP11mo ago
thanks, this helped.
Want results from more Discord servers?
Add your server