mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-22 22:00:50 -04:00
feat: make api only return json (#42320)
* fix(api): return json for delete + reset-progress * refactor(api): make .json calls explicit These .send() calls had objects as arguments. Using .json() makes it explicit without changing behaviour. * fix: return json or redirectWithFlash We should never be getting requests for plain text, but if we do they should be redirected back to the client. * fix: prioritize JSON responses If accepted, respond with JSON. If not, it's probably a bad request.
This commit is contained in:
committed by
GitHub
parent
989347387f
commit
7b65909522
@@ -193,7 +193,7 @@ module.exports = function (app) {
|
||||
pulls === parseInt(pulls, 10) && issues
|
||||
? Object.keys(JSON.parse(issues)).length - pulls
|
||||
: "Can't connect to GitHub";
|
||||
return res.send({
|
||||
return res.json({
|
||||
issues: issues,
|
||||
pulls: pulls
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user