fix panic: Only generate curl command if request is not nil

dev
Ice3man543 2021-10-25 18:22:33 +05:30
parent ca6cc51302
commit 4a29443752
1 changed files with 1 additions and 1 deletions

View File

@ -384,7 +384,7 @@ func (request *Request) executeRequest(reqURL string, generatedRequest *generate
}() }()
var curlCommand string var curlCommand string
if !request.Unsafe && resp != nil && generatedRequest.request != nil { if !request.Unsafe && resp != nil && generatedRequest.request != nil && resp.Request != nil {
bodyBytes, _ := generatedRequest.request.BodyBytes() bodyBytes, _ := generatedRequest.request.BodyBytes()
resp.Request.Body = ioutil.NopCloser(bytes.NewReader(bodyBytes)) resp.Request.Body = ioutil.NopCloser(bytes.NewReader(bodyBytes))
command, _ := http2curl.GetCurlCommand(resp.Request) command, _ := http2curl.GetCurlCommand(resp.Request)