Node-error cause analysis: Error: Multipart: Boundary not found

The front end USES umi-Request to upload the file and set it

The content-type headers: {‘ ‘:’ multipart/form – data ‘}

An error was reported when the back end received using Eggjs

nodejs.Error: Multipart: Boundary not found


Reason for the error: The Multipart did not find the Boundary
 
The upload file is a POST request form in multipart/form-data format

Content-type: The multipart/form-data did not follow the boundary
 
To sum up, the request header was set several times, overwriting the original form enctype= ‘multipart/form-data’
and finally finding the mutlipart/form-data in XHR. SetRequestHeader that overwriting the enctype setting in the form
To sum up: There is no need to set content-type: Mutipart /form-data repeatedly or it may overwrite the original and cause unexpected errors.


The Right way:
The front end

The back-end

The browser


https://blog.csdn.net/dongzhiliwansui/article/details/87896418

Read More: