feat: follow redirects in API

This commit is contained in:
Opliko
2024-03-28 11:53:49 +01:00
parent a38d0c14ab
commit e0138cbede

View File

@@ -61,6 +61,11 @@ async function xhr(options) {
const res = await fetch(url, options);
const { headers } = res;
if (headers.get('x-redirect')) {
return xhr({ url: headers.get('x-redirect'), ...options });
}
const contentType = headers.get('content-type');
const isJSON = contentType && contentType.startsWith('application/json');