You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Send a multipart request containing key "filename" but with no file associated with that key. Instead of returning 400 the server throws 500 and logs the NPE/IllegalStateException.
Additional context
I could not find a way to do the request using a Java lib HTTP client or Curl, but via Postman that was possible
The text was updated successfully, but these errors were encountered:
@tipsy the problem is caused by the fact that when no file is selected in Postman, there's no Content-Type header for that part (which causes instantiation of UploadedFile to throw IllegalArgumentException because contentType property is null), raw body looks like this:
And now, the question is how this should be handled? I don't see any better option than using an empty string as a fallback, when contentType is null. WDYT?
Actual behavior (the bug)
An
IllegalStateException
caused by null value not allowed is thrown when callingContext.uploadedFile(filename)
Expected behavior
Context.uploadedFile(fileName)
should return null and the user decides what to do with the file not presentTo Reproduce
Create a server with
Send a multipart request containing key "filename" but with no file associated with that key. Instead of returning 400 the server throws 500 and logs the NPE/IllegalStateException.
Additional context
I could not find a way to do the request using a Java lib HTTP client or Curl, but via Postman that was possible
The text was updated successfully, but these errors were encountered: