Error response in Django
A client wants to upload a file with the curl
command, and I need to validate its data.
What kind of response should I give to indicate that the file is corrupted, so that the client can use the exit 开发者_C百科code of curl
to figure out whether or not it succeeded?
HTTP code 400 is Bad Request
, which is probably the best bet here.
No reason for HTML, though. The response can be simply plain text, or something like JSON.
精彩评论