如何在使用reactor-netty发送请求之前删除自动生成的请求头?

huangapple go评论57阅读模式
英文:

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

问题

有没有可能在发送请求之前从reactor-netty中删除所有自动生成的标头?

我有一个使用案例,需要在我的请求中删除所有自动生成的标头。在apache httpclient4中,有可以在发送请求之前用于删除标头的拦截器。

在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?

答案1

得分: 1

Reactor Netty提供了lifecycle callbacks,以便可以拦截请求/响应

对于您的特定问题,您可以使用doOnRequest,如下所示:

HttpClient.create()
          ...
          .doOnRequest((req, con) -> ...)
英文:

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) -> ...)

huangapple
  • 本文由 发表于 2023年5月25日 14:55:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/76329610.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定