We have an API exposed in Gateway based on Spring Cloud Gateway using which people can upload/attach multipart files as a part of request body.
Now when the request lands to Gateway we see that some of the requests having Content-Type value as multipart/form-data and for some requests we see Content-Type value as multipart/form-data; boundary=---914083264482197888802695
Now the issue is with the requests which are having Content-Type value as multipart/form-data without boundary attribute.
We are getting the below exception when we try to open the file in our custom filters.
org.springframework.core.codec.DecodingException: No multipart boundary found in Content-Type: "multipart/form-data"
To avoid that in our custom Filters we want to modify the value of Content-Type header to contain some random value in the boundary something like below:
multipart/form-data; boundary=---914083264482197888802695
How to modify the the value Content-Type that is received in custom filters ?