Skip to content

Commit

Permalink
[minor] removing default headers for Content-Type and Accept, as its …
Browse files Browse the repository at this point in the history
…not necessary to always use application/json as the type. Also added a condition to read plain text response.
  • Loading branch information
sagrawal-godaddy committed Oct 9, 2018
1 parent 0455836 commit 8d4666d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/fetchUtils.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { withHeaders } from './withHeaders';

export const defaultHeaders = {
'Accept': 'application/json',
'Content-Type': 'application/json'
};
export const defaultHeaders = {};

export const handlers = {};

Expand Down Expand Up @@ -31,7 +28,7 @@ handlers.decode = function (response) {
if (contentType.includes('application/json')) {
return response.json()
.then(data => handlers.finish(response, data));
} else if (contentType.includes('text/html')) {
} else if (contentType.includes('text/html') || contentType.includes('text/plain')) {
return response.text()
.then(data => handlers.finish(response, data));
}
Expand Down

0 comments on commit 8d4666d

Please sign in to comment.