Page MenuHomePhabricator

API routes do not return appropriate response codes
Open, MediumPublicBUG REPORT

Description

What happens?:
All the /api/ routes located in isa/campaigns/routes.py do not return an appropriate response code when they fail to perform the requested task.
It simply returns "Failure", but with a response code 200 indicating that there was no problem.
This is most important for the api/post-contribution route as it can appear that an edit has been successful even if the server's request failed.

What should have happened instead?:
An appropriate 4xx or 5xx response code should be sent when the request fails.
In the case of the routes where the server makes requests to the Commons API (e.g. post-contribution route), the server should simply return the response code it receives from it's own request.

Event Timeline

NavinoEvans created this task.

Change 879905 had a related patch set uploaded (by Eugene233; author: Eugene233):

[labs/tools/Isa@master] API routes do not return appropriate response codes

https://gerrit.wikimedia.org/r/879905

Change 879905 abandoned by Eugene233:

[labs/tools/Isa@master] API routes do not return appropriate response codes

Reason:

https://gerrit.wikimedia.org/r/879905

Change 947395 had a related patch set uploaded (by Eugene233; author: Eugene233):

[labs/tools/Isa@m2c-rollback] API routes do not return appropriate response codes

https://gerrit.wikimedia.org/r/947395

Change 947395 abandoned by Eugene233:

[labs/tools/Isa@m2c-rollback] API routes do not return appropriate response codes

Reason:

Has been cherry picked to new main branch

https://gerrit.wikimedia.org/r/947395

Change 954640 had a related patch set uploaded (by Eugene233; author: Eugene233):

[labs/tools/Isa@main] API routes do not return appropriate response codes

https://gerrit.wikimedia.org/r/954640