Skip to content

Commit

Permalink
Merge pull request #208 from ddosify/develop
Browse files Browse the repository at this point in the history
Check status code for remote file on multipart
  • Loading branch information
fatihbaltaci authored May 29, 2023
2 parents 7d1bec4 + 23dfd5d commit ddf38c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions config/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,12 @@ func prepareMultipartPayload(parts []multipartFormData) (body string, contentTyp
return "", "", err
}

if !(response.StatusCode >= 200 && response.StatusCode <= 299) {
multipartError.wrappedErr = fmt.Errorf("Multipart: request to remote url (%s) failed. Status code: %d", part.Value, response.StatusCode)
multipartError.msg = "Error while getting remote multipart file"
return "", "", multipartError
}

_, err = io.Copy(formPart, response.Body)
if err != nil {
multipartError.wrappedErr = err
Expand Down
2 changes: 1 addition & 1 deletion main_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ var table = []struct {
{
name: "config_multipart_inject_1krps",
path: "config/config_testdata/benchmark/config_multipart_inject_1krps.json",
cpuTimeThreshold: 180,
cpuTimeThreshold: 200,
maxMemThreshold: 10,
avgMemThreshold: 15,
testType: Multipart,
Expand Down

0 comments on commit ddf38c3

Please sign in to comment.