resty
resty copied to clipboard
Can You Add two new usage functions?
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 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.
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.
The was RequestLogCallback and ResponseLogCallback feature was added on v2.3.0