resty icon indicating copy to clipboard operation
resty copied to clipboard

Can You Add two new usage functions?

Open iiiusky opened this issue 5 years ago • 2 comments

Can You add a method to directly obtain all the original request packets and response packets? It is convenient to output to the log center to understand the entire process of sending packets at that time. Similar to the following

GET /js/gowalker.js?v=2.5.3.0803 HTTP/1.1
Host: gowalker.org
Connection: close
Pragma: no-cache
Cache-Control: no-cache
User-Agent: xxxxx
Accept: */*
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: no-cors
Referer: https://gowalker.org/github.com/parnurzeal/gorequest
Accept-Encoding: gzip, deflate
Accept-Language: en;q=0.7
Cookie:xxxxx
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 6330
Content-Type: application/javascript
Date: Fri, 03 Jan 2020 13:26:39 GMT
Last-Modified: Sat, 02 Mar 2019 06:50:39 GMT
Server: Caddy
Connection: close

$(document).ready(function () {
   ……………………

iiiusky avatar Jan 03 '20 13:01 iiiusky

@iiiusky Typically this information gets logged in the Debug mode of Resty. Having debugged mode enabled will have some performance difference. So please test it out for your use case and decide it.

jeevatkm avatar Jan 08 '20 22:01 jeevatkm

In my program, I need to record the original request and response. The debug mode does not meet my needs. My current solution is to use httputil in OnAfterResponse to store the string in the header for use. If you can set a switch in the client to set whether to record the original request and response, and you can set the specified maximum body byte, then you can read the recorded string from two methods in the response. That would be very effective.

iiiusky avatar Jan 22 '20 03:01 iiiusky

The was RequestLogCallback and ResponseLogCallback feature was added on v2.3.0

jeevatkm avatar Oct 01 '23 04:10 jeevatkm