[ 
https://issues.apache.org/jira/browse/YUNIKORN-2163?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Peter Bacsko updated YUNIKORN-2163:
-----------------------------------
    Description: 
In the REST interface, sometimes we return 400 Bad request instead of a more 
appropriate 5xx like Internal server error (500). 4xx codes are client-related 
errors, ie something is wrong with the request. However, if the request itself 
is valid but cannot be fulfilled, it's better to use a server-related status 
code.

There are other status codes which do not follow the meaning of the code and 
what to use instead:
* An object (queue, partition, user, etc) does not exist: 400 Bad Request --> 
404 Not Found
* Internal metrics is disabled: 501 Not Implemented --> 500 Internal Server 
Error
* Event tracking disabled: 400 Bad Request --> 500 Internal Server Error

400 means that the request is malformed, eg. header or the request syntax is 
invalid.
It's better to return 404 when an object is not found, because in this case, 
the request itself is properly formatted. The real problem is that it refers to 
a resource which does not exist.

501 Not Implemented refers to a HTTP method (GET, POST, etc), not a 
functionality in the business logic.

  was:In the REST interface, sometimes we return 404 Bad request instead of a 
more appropriate 5xx like Internal server error (500). 4xx codes are 
client-related errors, ie something is wrong with the request. However, if the 
request itself is valid but cannot be fulfilled, it's better to use a 
server-related status code.


> Fix HTTP status codes
> ---------------------
>
>                 Key: YUNIKORN-2163
>                 URL: https://issues.apache.org/jira/browse/YUNIKORN-2163
>             Project: Apache YuniKorn
>          Issue Type: Sub-task
>          Components: core - common
>            Reporter: Peter Bacsko
>            Assignee: Peter Bacsko
>            Priority: Major
>
> In the REST interface, sometimes we return 400 Bad request instead of a more 
> appropriate 5xx like Internal server error (500). 4xx codes are 
> client-related errors, ie something is wrong with the request. However, if 
> the request itself is valid but cannot be fulfilled, it's better to use a 
> server-related status code.
> There are other status codes which do not follow the meaning of the code and 
> what to use instead:
> * An object (queue, partition, user, etc) does not exist: 400 Bad Request --> 
> 404 Not Found
> * Internal metrics is disabled: 501 Not Implemented --> 500 Internal Server 
> Error
> * Event tracking disabled: 400 Bad Request --> 500 Internal Server Error
> 400 means that the request is malformed, eg. header or the request syntax is 
> invalid.
> It's better to return 404 when an object is not found, because in this case, 
> the request itself is properly formatted. The real problem is that it refers 
> to a resource which does not exist.
> 501 Not Implemented refers to a HTTP method (GET, POST, etc), not a 
> functionality in the business logic.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to