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 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.