An 'Invalid' boundary 'for' Multipart /form-data 'request' error occurred regarding the use of 'multipart' #1765
Unanswered
Sparkel-wsl
asked this question in
Q&A
Replies: 2 comments 1 reply
-
Have a look at this example https://github.com/tokio-rs/axum/blob/main/examples/parse-body-based-on-content-type/src/main.rs |
Beta Was this translation helpful? Give feedback.
1 reply
-
I ran into this today; the example suggested in the other comment may not be necessary. To anyone else coming across this, ensure that your form element (or your Postman request) is formatted using "multipart/form-data" (i.e. The default of x-www-urlencoded does not play nicely with Axum's multipart, nor with axum_typed_multipart. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Bug Report
Version
cargo 1.64.0 (387270bc7 2022-09-16)
Platform
Windows 10 64-bit
Crates
axum = { version = "0.6.1",features=["multipart"]}
Description
Hello, I wrote the backend of 'ueditor' in 'rust', normal images can be uploaded normally, http headers are: Content-type:application/json, but when uploads the doodle file, we get an error 'multipart/form-data' request '. When I look at the http request headers, I see Content-Type: application/x-www-form-urlencoded, which is a base64 string in form-data. Looking at the axum documentation, I found that axum::Form accepts.
But uploading images and doodling must be the same request address. How can axum be compatible with both headers Content-type:application/json Content-Type: application/x-www-form-urlencoded request.
你好,我使用
rust
编写ueditor
的后端,普通图片可以正常上传,http headers是:Content-type:application/json,但在上传涂鸦文件时,发生了这么一个错误multipart/form-data
request`。我查看http request headers 发现 Content-Type : application/x-www-form-urlencoded,在 form-data 里面的值是 base64字符串。我查阅 axum的文档后发现,可以用axum::Form 接收。但是上传图片和涂鸦必须是一个请求地址,axum 如何同时兼容headers Content-type:application/json Content-Type : application/x-www-form-urlencoded 的请求。
Beta Was this translation helpful? Give feedback.
All reactions