Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-19283

fetch override does not return the response in xwiki.js 12.10.10

    XMLWordPrintable

Details

    • Easy
    • N/A
    • N/A

    Description

      Hello,

      We are trying to upgrade from XWiki 12.10.4 to 12.10.10

      Unfortunately, we detected a brocker change for this piece of code was added in 12.10.9 which is a bit surprising for a patch version
      [https://github.com/xwiki/xwiki-platform/blob/xwiki-platform-12.10.9/xwiki-platform-core/xwiki-platform-web/src/main/webapp/resources/js/xwiki/xwiki.js
      ]

      /**
       * Overwrite the fetch function in order to add our own response callback on all fetch requests made from this page.
       */
       var interceptFetch = function() {
       var originalFetch = window.fetch;
       if (originalFetch) {
       window.fetch = function() {
       return originalFetch.apply(this, arguments).then(function(response) {
       handleResponseHeaders($.proxy(response.headers, 'get'));
       });
       };

      Our XWiki frontend is using fetch to reach our own XWiki API extension so all our UI that use fetch call are not displayed due to a javascript error.

      It seems that your overrided version of fetch doesn't return the result and it seems impossible to chain calls like we do here

      fetch("/rest/v1/identity/me").then(console.log)

      or

      fetch("rest/jobstatus/OurJobId").then(process...)

      I noticed that you have been patch it in 13.4

      return originalFetch.apply(this, arguments).then(function(response) {
       handleResponseHeaders($.proxy(response.headers, 'get'));
       return response;

      So maybe it should be applied in a 12.10.11 and it would solve all our issues ?

      If not possible we will try a major upgrade to 13.10.2 but it was not planed so far for now.

      Thanks

      Attachments

        Issue Links

          Activity

            People

              mleduc Manuel Leduc
              cracky5457 Axel
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: