Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Commit

Permalink
Changed text/json to application/json
Browse files Browse the repository at this point in the history
text/json isn't a content-type but application/json is. With this change, theJSON will be properly shown inside of browsers like Firefox that offer a cool json viewer. You can see an example of the viewer properly working for some JSON at this link: https://jsonplaceholder.typicode.com/todos/1
  • Loading branch information
ZakCodes authored Dec 30, 2018
1 parent 966ae91 commit 5390fac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ http.createServer(function (req, res) {
}
dbo.close();
if(result[0]){
res.writeHead(200, {'Content-Type': 'text/json'});
res.writeHead(200, {'Content-Type': 'application/json'});
res.write(JSON.stringify(result[0]));
}else{
res.writeHead(400, {'Content-Type': 'text/json'});
res.writeHead(400, {'Content-Type': 'application/json'});
res.write(JSON.stringify({"error":"Invalid base or symbols"}))
}
res.end();
Expand Down

0 comments on commit 5390fac

Please sign in to comment.