Hello,
I am using swagger version 4.12.0. OpenAPI Spec 2.0.
I have an API POST call where I am sending a formData file type OPTIONAL param in the request. But when using the swagger ui, for the case where I do not select any file for this optional param field. I receive this error: "[java.lang.ArrayIndexOutOfBoundsException: Array index out of range: -8190". The request works when I select a file for the request. It seems to fail before it even reaches my backend code.
I was able to reproduce what I think is the same error on the swagger sample editor:
Steps to reproduce:
On the right panel, try out POST /pet (Change first property id: from 0 to 100 , leave other fields as is) hit enter
Go to post /pet/{petId}/uploadImage Try it out, set petId to 100, leave other formData fields empty. Hit enter
See response: "message": "org.jvnet.mimepull.MIMEParsingException: Missing start boundary"
On left side code panel, ctrl + F “/pet/{petId}/uploadImage:” the formData fields are both required: false.
This is actually a regression, as before I updated to version 4.12.0, this same API used to work without any errors. I guess at some version level, some additional checking was added to the params where this issue was introduced.
It looks like this fail might be because even though I do not add this optional formData field, the CURL request swagger UI sends still includes this header -> -H 'Content-Type: multipart/form-data'. When I try the curl command myself I see the same error, but if I remove this multipart/form-data contentType header field from the Curl request. It then succeeds.
Thanks a lot for taking the time to look at this, hope this could be resolved..
Hello, I am using swagger version 4.12.0. OpenAPI Spec 2.0. I have an API POST call where I am sending a formData file type OPTIONAL param in the request. But when using the swagger ui, for the case where I do not select any file for this optional param field. I receive this error: "[java.lang.ArrayIndexOutOfBoundsException: Array index out of range: -8190". The request works when I select a file for the request. It seems to fail before it even reaches my backend code.
I was able to reproduce what I think is the same error on the swagger sample editor: Steps to reproduce:
This is actually a regression, as before I updated to version 4.12.0, this same API used to work without any errors. I guess at some version level, some additional checking was added to the params where this issue was introduced.
It looks like this fail might be because even though I do not add this optional formData field, the CURL request swagger UI sends still includes this header -> -H 'Content-Type: multipart/form-data'. When I try the curl command myself I see the same error, but if I remove this multipart/form-data contentType header field from the Curl request. It then succeeds.
Thanks a lot for taking the time to look at this, hope this could be resolved..