Skip to content

Commit

Permalink
credentials should be include by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin Curtin committed Apr 6, 2017
1 parent 65771df commit 5457157
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/get_request_options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function getRequestOptions (jsonFetchOptions: JsonFetchOptions):
parsedOptions.headers['Content-Type'] = 'application/json';
}

if (jsonFetchOptions.credentials !== undefined) {
if (jsonFetchOptions.credentials === undefined) {
parsedOptions.credentials = 'include';
}

Expand Down
2 changes: 2 additions & 0 deletions src/get_request_options/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import getRequestOptions from '.';
describe('getRequestOptions', async function () {
it('populates an options object without undefined keys', function () {
const expected = {
credentials: 'include',
headers: {
Accept: 'application/json',
},
Expand All @@ -19,6 +20,7 @@ describe('getRequestOptions', async function () {

it('sets content type header only when there is a body', function () {
const expected = {
credentials: 'include',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Expand Down

0 comments on commit 5457157

Please sign in to comment.