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已经支持了

最新文章

  1. css自适应代码-iphone端
  2. WordPress添加固定位置的百度分享按钮
  3. X230上安装Yosemite/Win7-黑苹果之路
  4. Codeforces Gym 100463D Evil DFS
  5. Android 签名(3)已签名的apk中的文件
  6. 自定义scrollbar
  7. QTP自动化测试权威指南 连载(一)
  8. A - 数塔
  9. 使用XML的五种场合,XML基本规则,XML的术语,结构与语法
  10. 【Android】获取手机中已安装apk文件信息(PackageInfo、ResolveInfo)(应用图片、应用名、包名等)
  11. ice grid 完整部署过程
  12. Python系列之 - python运算符
  13. 六星经典CSAPP-笔记(10)系统IO
  14. 【Netty源码分析】发送数据过程
  15. session 和 cookie
  16. appium+java(四)微信公众号自动化测试实践
  17. Python2.7字符编码详解
  18. vue-cli 3.x 使用
  19. 学习笔记之Java
  20. 常用Git命令清单(转)

热门文章

  1. uiautomatorviewer.bat使用方法
  2. 再论IBatisNet + Castle进行项目的开发
  3. std::deque
  4. js一个数组变为指定长度的多个数组
  5. AEcs6破解版下载
  6. net.mvc中并发限制
  7. Checksum 磁盘扇区故障检测
  8. 10.Query an Array-官方文档摘录
  9. 我的Android进阶之旅------>解决Android Studio编译后安装apk报错:The APK file does not exist on disk
  10. HTML(form标签)、CSS