How to enable wire logging for a java HttpURLConnection traffic?

后端 未结 8 954
离开以前
离开以前 2020-11-27 04:56

I\'ve used Jakarta commons HttpClient in another project and I would like the same wire logging output but using the \"standard\" HttpUrlConnection.

I\'ve used Fiddl

8条回答
  •  猫巷女王i
    2020-11-27 05:50

    I don't think you can do that automatically, but you could subclass FilterOutputStream and FilterInputStream with the HttpUrlConnection's output and input streams as parameters. Then as bytes are written/read, log them as well as pass them through to the underlying streams.

提交回复
热议问题