Closed
Description
Affects: Spring MVC 5.1.9.RELEASE
Hi,
My REST API takes as input a mandatory X-Request-ID
header that is transformed to a UUID
object.
So my REST controller method has this parameter:
@RequestHeader(value="X-Request-ID", required=true) UUID xRequestID
However, if the X-Request-ID
HTTP header:
- is absent : 400 Bad Request (OK)
- is empty (i.e. the empty string) : 200 OK (NOK, should be 400)
- is blank (i.e. a string with whitespace only) : 200 OK (NOK, should be 400)
- is not a UUID (for instance
"foobar"
) : 400 Bad Request (OK)
It seems that the problem comes from:
- 'is empty' case:
StringToUUIDConverter
returnsnull
- 'is blank' case:
StringToUUIDConverter
fails, then Spring MVC defaults toUUIDEditor
that returnsnull
.