HttpStatusCode
https://docs.microsoft.com/en-us/dotnet/api/system.net.httpstatuscode?view=netframework-4.7.2
422 UnprocessableEntity
What HTTP status response code should I use if the request is missing a required parameter?
Status 422 seems most appropiate based on the spec.
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. For example, this error condition may occur if an XML request body contains well-formed (i.e., syntactically correct), but semantically erroneous, XML instructions.
They state that malformed xml is an example of bad syntax (calling for a 400). A malformed query string seems analogous to this, so 400 doesn't seem appropriate for a well-formed query-string which is missing a param.
UPDATE @DavidV correctly points out that this spec is for WebDAV, not core HTTP. But some popular non-WebDAV APIs are using 422 anyway, for lack of a better status code (see this).
system.net.HttpStatusCode 没有UnprocessableEntity枚举类型,422。
https://github.com/dotnet/corefx/issues/4382
https://github.com/dotnet/core/issues/1335 但是.net core 2.1已经支持了
最新文章
- css自适应代码-iphone端
- WordPress添加固定位置的百度分享按钮
- X230上安装Yosemite/Win7-黑苹果之路
- Codeforces Gym 100463D Evil DFS
- Android 签名(3)已签名的apk中的文件
- 自定义scrollbar
- QTP自动化测试权威指南 连载(一)
- A - 数塔
- 使用XML的五种场合,XML基本规则,XML的术语,结构与语法
- 【Android】获取手机中已安装apk文件信息(PackageInfo、ResolveInfo)(应用图片、应用名、包名等)
- ice grid 完整部署过程
- Python系列之 - python运算符
- 六星经典CSAPP-笔记(10)系统IO
- 【Netty源码分析】发送数据过程
- session 和 cookie
- appium+java(四)微信公众号自动化测试实践
- Python2.7字符编码详解
- vue-cli 3.x 使用
- 学习笔记之Java
- 常用Git命令清单(转)