Closed
Description
Describe the bug
After routing multipart/form-data
through gateway mvc, downstream service receive request but without multipart file.
I looked into code of gateway and in RestClientProxyExchange
we have
@Override
public ServerResponse exchange(Request request) {
return restClient.method(request.getMethod()).uri(request.getUri())
.headers(httpHeaders -> httpHeaders.putAll(request.getHeaders()))
.body(outputStream -> copyBody(request, outputStream))
.exchange((clientRequest, clientResponse) -> doExchange(request, clientResponse), false);
}
there is not copy multipart data from original request.
Example route:
@Bean
fun dataStorageFileUpload(): RouterFunction<ServerResponse> {
val servicesUrl = services.url!!
Objects.requireNonNull(servicesUrl["dataStorageService"], "Data storage service url is empty")
return GatewayRouterFunctions.route("dataStorageFileUpload")
.PUT("/storage/file/**", http(servicesUrl["dataStorageService"]))
.before(BeforeFilterFunctions.stripPrefix(1))
.filter(HandlerFilterFunction.ofRequestProcessor(authenticationPopular))
.after(AfterFilterFunctions.removeResponseHeader(GROUP_HEADER))
.after(AfterFilterFunctions.removeResponseHeader(HttpHeaders.AUTHORIZATION))
.after(AfterFilterFunctions.removeResponseHeader(TOKEN_HEADER))
.build()
}