简体   繁体   中英

What http status should I return if client does not follow the rules?

For example, we have an API POST /test , which only accept name: AA or name: BB headers.

If a client send a name: CC header, which status code is preferred?

400? 404? 500?

If is a permission problem maybe you can send 403 (forbidden). 404 is not found and is not the correct meaning of that and 500 is a server error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM