Skip to content

Commit

Permalink
Return 415 rather than 400 on Urlencoded Content-Type mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
mpalmer committed Apr 15, 2024
1 parent ba7fd04 commit 6c3b5d1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions actix-web/CHANGES.md
Expand Up @@ -10,6 +10,8 @@

- Minimum supported Rust version (MSRV) is now 1.72.

- the Urlencoded extractor now returns 415 (Media Type Unsupported) if the request's `Content-Type` is not `application/x-www-form-urlencoded`, rather than 400 (Bad Request).

## 4.5.1

### Fixed
Expand Down
1 change: 1 addition & 0 deletions actix-web/src/error/mod.rs
Expand Up @@ -100,6 +100,7 @@ impl ResponseError for UrlencodedError {
match self {
Self::Overflow { .. } => StatusCode::PAYLOAD_TOO_LARGE,
Self::UnknownLength => StatusCode::LENGTH_REQUIRED,
Self::ContentType => StatusCode::UNSUPPORTED_MEDIA_TYPE,
Self::Payload(err) => err.status_code(),
_ => StatusCode::BAD_REQUEST,
}
Expand Down

0 comments on commit 6c3b5d1

Please sign in to comment.