In this example, an Edge Function is used to add, delete, or modify request headers.
const RESOURCE_URL = 'https://data.playground.edgeone.ai/api/user/list';
async function handleRequest() {
const newRequest = new Request(RESOURCE_URL);
newRequest.headers.set('x-custom-header', 'test');
newRequest.headers.append('x-edge-client', 'edgeone');
const response = await fetch(newRequest);
return response;
}
addEventListener('fetch', event => {
event.respondWith(handleRequest());
});