问题原文
原帖链接 · AlterPHP · CC BY-SA 3.0
I'm coding a user registration process and wondering if 200 (OK) is the most relevant HTTP status for response after username/password creation, when waiting for user activation.
HTTP status 202 (accepted) seems relevant too.
已采纳解答
原帖链接 · Kenny Grant · CC BY-SA 3.0
It depends what you do after registration and what kind of website:
- If an api 200 is fine (201 or 202 would be ok but unusual)
- If a website 200 is fine if showing information
- If a website, 302 is also fine if you're redirecting to a more useful page after creation (with an informational message).
Very few websites use codes other than 100,200,301,302,400,401,403,404,500, it's best not to get too hung up on which one you're using, as in practice most clients will treat them as broad classes (10x,20x,30x,40x,50x), and it won't matter which you choose.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
