mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-27 17:16:14 +01:00 
			
		
		
		
	feat: follow redirects in API
This commit is contained in:
		| @@ -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'); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user