AnWeber / vscode-httpyac

Quickly and easily send REST, Soap, GraphQL, GRPC, MQTT and WebSocket requests directly within Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=anweber.vscode-httpyac
MIT License
224 stars 20 forks source link

multipart/form-data request encounter MultipartException & IOException #191

Closed domeniczz closed 1 year ago

domeniczz commented 1 year ago
POST http://localhost:63050/media/upload/coursefile
Content-Type: multipart/form-data; boundary=WebAppBoundary

--WebAppBoundary
Content-Disposition: form-data; name="file"; filename="media-test.txt"
Content-Type: application/octet-stream

< D:/Download/media-test.txt

When I run this request, I get this error:

org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.impl.IOFileUploadException: Processing of multipart/form-data request failed. Stream ended unexpectedly

However, if I run this request in IntelliJ IDEA (with HTTP Client plugin), there're no errors, everything works perfect.

Thus, I think it's not the problem of my backend code.

AnWeber commented 1 year ago

@domeniczz Spontaneously I would say that the last --WebKitFormBoundary-- is missing. But Intellij Idea doesn't seem to need it at all. So workaround currently is that this is added manually. But I will extend my implementation so that I also add the end delimiter

AnWeber commented 1 year ago

Does Intellij Idea really support adding the end boundary? In the example the boundary is only in the same line as the file import

image

I will test the correct behaviour in Intellij myself

domeniczz commented 1 year ago

Don't bother.

I add boundary at the end and test in intelliJ IDEA and VSCode. It works!!

Thanks a lot.