Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit 83ea6c3d authored by M. Reza Qorib's avatar M. Reza Qorib
Browse files

[#140654507] #10 fix Server.js to give correct output on json and non json response

parent 87843815
Branches
No related tags found
No related merge requests found
...@@ -44,7 +44,8 @@ export default class Server { ...@@ -44,7 +44,8 @@ export default class Server {
if (response.status === 204) { if (response.status === 204) {
return response; return response;
} }
return response.hasOwnProperty(response) ? response.json() : response; const contentType = response.headers.get("content-type");
return contentType && contentType.indexOf("application/json") !== -1 ? response.json() : response.text();
}); });
/* istanbul ignore next */ /* istanbul ignore next */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment