Use CRLF as delimiter for requests

dev
Ice3man543 2021-02-04 22:27:47 +05:30
parent e63172d2bf
commit d1c3be8199
2 changed files with 6 additions and 9 deletions

View File

@ -108,15 +108,7 @@ func (r *requestGenerator) makeHTTPRequestFromModel(ctx context.Context, data st
// makeHTTPRequestFromRaw creates a *http.Request from a raw request
func (r *requestGenerator) makeHTTPRequestFromRaw(ctx context.Context, baseURL, data string, values, payloads map[string]interface{}) (*generatedRequest, error) {
// Add trailing line to request body based on content type
// handling multipart bodies differently.
if !strings.HasSuffix(data, "\r\n") && !strings.HasSuffix(data, "\n") {
if !strings.Contains(r.request.Headers["Content-Type"], "multipart") {
data += "\n"
} else {
data += "\r\n"
}
}
data += "\r\n"
return r.handleRawWithPaylods(ctx, data, baseURL, values, payloads)
}

View File

@ -103,6 +103,11 @@ func (r *Request) Compile(options *protocols.ExecuterOptions) error {
}
if len(r.Raw) > 0 {
for i, raw := range r.Raw {
if !strings.Contains(raw, "\r\n") {
r.Raw[i] = strings.ReplaceAll(raw, "\n", "\r\n")
}
}
r.rawhttpClient = httpclientpool.GetRawHTTP()
}
if len(r.Matchers) > 0 || len(r.Extractors) > 0 {