javaspring-bootspring-webfluxproject-reactorreactor-netty

How can I remove auto generated headers from a request before sending it in reactor-netty?


Is it possible to remove all auto generated headers from a request before it is sent in reactor-netty?

I have a use case where i need to remove all auto generated headers in my request. In apache httpclient4 there are intercepters which can be used to remove the headers before request is sent.

Is there some way to do this in reactor-netty?


Solution

  • Reactor Netty provides lifecycle callbacks so that one can intercept the request/response

    For your particular question you can use doOnRequest, as in the code below:

    HttpClient.create()
              ...
              .doOnRequest((req, con) -> ...)