Interceptors
function intercept?(event: OutsmartlyInterceptEvent): PromiseOrValue<Response>;
type PromiseOrValue<T> = Promise<T> | T;function intercept(event) {
return fetch('https://api.github.com/users/outsmartly');
}async function intercept(event) {
const url = new URL(event.url);
// This will change only the host, not the pathname/search/port
url.host = 'api.github.com';
const request = new Request(url, event.request);
return await fetch(request);
}Serverless API Endpoints
Last updated
Was this helpful?