开发者

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?

(i.e. I don't want to make him parse HTML.)


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜