Fetch-API not sending credentials when credentials are omitted

Issue #19851173 • Unassigned

Details

Author
Noobish N.
Created
Dec 6, 2018
Privacy
This issue is public.
Found in
  • Microsoft Edge
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

Fetch returns incorrect results if credentials: ‘same-origin’ is omitted.
But the doc at
https://github.com/github/fetch#sending-cookies
states that the default is "same-origin".

So all fetch requests that go to SQL and require a user that is sent along in the cookie return either an error, or an empty array in Edge, while it works flawlessly in Chrome and Firefox and IE11 with Fetch-polyfill

note: to get the default-behaviour, comment out “credentials” in options !
Edge/17.17134

  let options: any = {
        "method": "POST",
        // "headers": { 'auth': '1234','content-type': 'application/json'},
        // https://stackoverflow.com/questions/38156239/how-to-set-the-content-type-of-request-header-when-using-fetch-api
        // "headers": new Headers({ 'content-type': 'application/json' })
        // "headers": { "Content-Type": "application/json" } 
        // "headers": new Headers({ 'Content-Type': 'application/json' }) 
        // "headers": { 'Accept': 'application/json', 'Content-Type': 'application/json' },
        // "headers": new Headers({ 'Accept': 'application/json', 'Content-Type': 'application/json' }), 
        "headers": myHeaders
        // ,"mode": "no-cors" 
        , credentials: 'same-origin' 
        , "body": <any>null
    };

fetch("ajaxData.ashx", options);

Attachments

0 attachments

    Comments and activity

    • let myHeaders = new Headers();
      myHeaders.append("Accept", “application/json”);
      myHeaders.append("Content-Type", “application/json”);

      Why can I not edit an issue, if I am the creator, at least within an hour of creating the issue ?

    You need to sign in to your Microsoft account to add a comment.

    Sign in