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.

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

05-01 06:45