This commit is contained in:
Ice3man543 2021-09-10 21:13:52 +05:30
parent 1976651890
commit e8cadd86f1

View File

@ -434,11 +434,16 @@ func (r *Request) executeRequest(reqURL string, request *generatedRequest, previ
finalEvent := make(output.InternalEvent) finalEvent := make(output.InternalEvent)
// Decode gbk response content-types // Decode gbk response content-types
if contentTypes, ok := resp.Header["Content-Type"]; ok && len(contentTypes) > 0 && strings.Contains(contentTypes[0], "gbk") && strings.Contains(contentTypes[0], "gb2312") { if contentTypes, ok := resp.Header["Content-Type"]; ok && len(contentTypes) > 0 {
for _, value := range contentTypes {
if strings.Contains(value, "gbk") && strings.Contains(value, "gb2312") {
dumpedResponse, err = decodegbk(dumpedResponse) dumpedResponse, err = decodegbk(dumpedResponse)
if err != nil { if err != nil {
return errors.Wrap(err, "could not store in project file") return errors.Wrap(err, "could not store in project file")
} }
break
}
}
} }
outputEvent := r.responseToDSLMap(resp, reqURL, matchedURL, tostring.UnsafeToString(dumpedRequest), tostring.UnsafeToString(dumpedResponse), tostring.UnsafeToString(data), headersToString(resp.Header), duration, request.meta) outputEvent := r.responseToDSLMap(resp, reqURL, matchedURL, tostring.UnsafeToString(dumpedRequest), tostring.UnsafeToString(dumpedResponse), tostring.UnsafeToString(data), headersToString(resp.Header), duration, request.meta)