[Webkit-unassigned] [Bug 169970] JavaScript is not correctly connecting to rest api in iOS 10.3 beta

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Mar 26 06:55:16 PDT 2017


https://bugs.webkit.org/show_bug.cgi?id=169970

--- Comment #21 from paladox <thomasmulhall410 at yahoo.com> ---
Doing something like



function _urlWithParams(url) {
      return url;
    }
    var urlWithParams = _urlWithParams('https://gerrit-review.googlesource.com/config/server/version');
var fetchOptions = {
        //headers: '',
        credentials: 'same-origin',
        mode: 'no-cors',
        headers: {'content-type': 'application/json'},
      };
  fetch(urlWithParams, fetchOptions)
    .then(function(response) {
      console.error('response', response)
      console.error('header', response.headers.get('Content-Type'))
      return response.text().then(function(text) {
        var result;
        try {
          result = JSON.parse(text.substring(JSON_PREFIX.length));
        } catch (_) {
          result = null;
        }
        console.error('got text', text)
        return result;
      });
    }).catch(function(ex) {
      console.error('failed', ex)
    })

fails. I may have done it wrong but not sure.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170326/0e035c03/attachment.html>


More information about the webkit-unassigned mailing list