Readable debug logging for http requests with spring webclient

后端 未结 3 1016
死守一世寂寞
死守一世寂寞 2021-02-15 12:31

I\'m using Spring reactive WebClient for sending requests to a http server. Inorder to view the underlying request & response that\'s being sent, I enabled debug logging for

3条回答
  •  佛祖请我去吃肉
    2021-02-15 13:10

    Seems like the responding server is returning gzipped content, so it makes sense that you're not able to read it.

    If you really want to intercept at the raw HTTP level, ensure your request header does not specify it can accept GZipped content (accept-encoding: gzip).

    Another alternative may be to log the request at another layer, when it's already been unzipped from the raw data stream, but not yet processed by your application code - not sure how this would work in Reactive webclient though ;)

提交回复
热议问题