From 27bdf9fb0bb94c4382ffff5827907cc768654813 Mon Sep 17 00:00:00 2001 From: Eric Mc Sween <5454374+emcsween@users.noreply.github.com> Date: Mon, 25 Sep 2023 10:18:05 -0400 Subject: [PATCH] Merge pull request #14958 from overleaf/em-fetch-json-real-empty-bodies fetchJSON: only send a body when explicitly asked GitOrigin-RevId: 08b05ad0822a11671ce5bb2522c1ce534ad19c82 --- services/web/frontend/js/infrastructure/fetch-json.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/web/frontend/js/infrastructure/fetch-json.ts b/services/web/frontend/js/infrastructure/fetch-json.ts index bfcc0f7f65..61d96bacce 100644 --- a/services/web/frontend/js/infrastructure/fetch-json.ts +++ b/services/web/frontend/js/infrastructure/fetch-json.ts @@ -103,7 +103,7 @@ export class FetchError extends OError { function fetchJSON( path: FetchPath, { - body = {}, + body, headers = {}, method = 'GET', credentials = 'same-origin', @@ -123,7 +123,7 @@ function fetchJSON( method, } - if (method !== 'GET' && method !== 'HEAD') { + if (body !== undefined) { options.body = JSON.stringify(body) }