Просмотр исходного кода

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

fetchJSON: only send a body when explicitly asked
GitOrigin-RevId: 08b05ad0822a11671ce5bb2522c1ce534ad19c82
Eric Mc Sween 2 лет назад
Родитель
Сommit
27bdf9fb0b
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      services/web/frontend/js/infrastructure/fetch-json.ts

+ 2 - 2
services/web/frontend/js/infrastructure/fetch-json.ts

@@ -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)
   }