Fix linter warnings
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
import { type HandleFetch } from "@sveltejs/kit";
|
||||
import { type HandleFetch } from '@sveltejs/kit';
|
||||
|
||||
export const handleFetch: HandleFetch = async ({ request, fetch }) => {
|
||||
if (request.url.startsWith('https://maps.owlboard.info')) {
|
||||
const newUrl = request.url.replace('https://maps.owlboard.info', 'http://localhost:3000');
|
||||
|
||||
const headers = new Headers(request.headers);
|
||||
headers.set('host', 'maps.owlboard.info');
|
||||
if (request.url.startsWith('https://maps.owlboard.info')) {
|
||||
const newUrl = request.url.replace('https://maps.owlboard.info', 'http://localhost:3000');
|
||||
|
||||
request = new Request(newUrl, {
|
||||
method: request.method,
|
||||
headers: headers,
|
||||
body: request.body,
|
||||
// @ts-ignore - 'duplex' is needed for node fetch with bodies
|
||||
duplex: 'half'
|
||||
});
|
||||
}
|
||||
const headers = new Headers(request.headers);
|
||||
headers.set('host', 'maps.owlboard.info');
|
||||
|
||||
return fetch(request);
|
||||
}
|
||||
request = new Request(newUrl, {
|
||||
method: request.method,
|
||||
headers: headers,
|
||||
body: request.body,
|
||||
// @ts-expect-error - 'duplex' is needed for node fetch with bodies
|
||||
duplex: 'half'
|
||||
});
|
||||
}
|
||||
|
||||
return fetch(request);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user