无效格式的 HTTP 状态代码
HTTP status code for invalid format
我们的系统正在接受文本文件上传,并且应该有一个预先确定的行数。如果行数不匹配,我想向用户发送某种警告,要求确认他们是否仍要上传。
是否有特定的状态代码可用于此类情况?
可以使用422.
The 422 (Unprocessable Entity) status code means the server
understands the content type of the request entity (hence a
415(Unsupported Media Type) status code is inappropriate), and the
syntax of the request entity is correct (thus a 400 (Bad Request)
status code is inappropriate) but was unable to process the contained
instructions.
你可以看看这个。
我们的系统正在接受文本文件上传,并且应该有一个预先确定的行数。如果行数不匹配,我想向用户发送某种警告,要求确认他们是否仍要上传。
是否有特定的状态代码可用于此类情况?
可以使用422.
The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity (hence a 415(Unsupported Media Type) status code is inappropriate), and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions.
你可以看看这个。