Fakultas Ilmu Komputer UI

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
......@@ -44,7 +44,8 @@ export default class Server {
if (response.status === 204) {
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 */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment