[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
import from
vinxi/http
thanks, this helped.