Skip to content

Commit

Permalink
Send 400 for PathVariable that is null after conversion
Browse files Browse the repository at this point in the history
This implies a value was actually sent, but is not something
that can be converted to the expected type.

Closes gh-31382
  • Loading branch information
rstoyanchev committed Oct 24, 2023
1 parent 33fba8e commit 5c6b9be
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -88,7 +88,7 @@ public final MethodParameter getParameter() {

@Override
public HttpStatusCode getStatusCode() {
return HttpStatus.INTERNAL_SERVER_ERROR;
return (isMissingAfterConversion() ? HttpStatus.BAD_REQUEST : HttpStatus.INTERNAL_SERVER_ERROR);
}

}

0 comments on commit 5c6b9be

Please sign in to comment.