Correctly proxy GET and HEAD requests instead of dying (#542)

This commit is contained in:
Marshall Polaris 2022-06-18 02:09:44 -07:00 committed by GitHub
parent 24176c864d
commit 08632a3a07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,7 +41,9 @@ export const fetchBackend = (req: NextApiRequest, name: V2CloudFunction) => {
'Content-Type',
'Origin',
])
return fetch(url, { headers, method: req.method, body: req })
const hasBody = req.method != 'HEAD' && req.method != 'GET'
const opts = { headers, method: req.method, body: hasBody ? req : undefined }
return fetch(url, opts)
}
export const forwardResponse = async (