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

Merge pull request #3600 from overleaf/ae-credentials-same-origin

Explicitly set credentials: same-origin on fetch requests

GitOrigin-RevId: 17204554f560e2a04b35c631f571fd73f91efadd
Miguel Serrano 5 лет назад
Родитель
Сommit
1036708e0e
1 измененных файлов с 8 добавлено и 1 удалено
  1. 8 1
      services/web/frontend/js/infrastructure/fetch-json.js

+ 8 - 1
services/web/frontend/js/infrastructure/fetch-json.js

@@ -23,7 +23,13 @@ export function deleteJSON(path, options) {
 
 function fetchJSON(
   path,
-  { body = {}, headers = {}, method = 'GET', ...otherOptions }
+  {
+    body = {},
+    headers = {},
+    method = 'GET',
+    credentials = 'same-origin',
+    ...otherOptions
+  }
 ) {
   const options = {
     ...otherOptions,
@@ -33,6 +39,7 @@ function fetchJSON(
       'X-Csrf-Token': window.csrfToken,
       Accept: 'application/json'
     },
+    credentials,
     method
   }