Merge pull request #14958 from overleaf/em-fetch-json-real-empty-bodies

fetchJSON: only send a body when explicitly asked
GitOrigin-RevId: 08b05ad0822a11671ce5bb2522c1ce534ad19c82
This commit is contained in:
Eric Mc Sween 2023-09-25 10:18:05 -04:00 committed by Copybot
parent 43570cb7b4
commit 27bdf9fb0b

View file

@ -103,7 +103,7 @@ export class FetchError extends OError {
function fetchJSON<T>(
path: FetchPath,
{
body = {},
body,
headers = {},
method = 'GET',
credentials = 'same-origin',
@ -123,7 +123,7 @@ function fetchJSON<T>(
method,
}
if (method !== 'GET' && method !== 'HEAD') {
if (body !== undefined) {
options.body = JSON.stringify(body)
}