Skip to content

Commit

Permalink
converter/har: remove redundant nil check
Browse files Browse the repository at this point in the history
From the Go specification:

  "1. For a nil slice, the number of iterations is 0." [1]

Therefore, an additional nil check for before the loop is unnecessary.

[1]: https://go.dev/ref/spec#For_range

Signed-off-by: Eng Zer Jun <[email protected]>
  • Loading branch information
Juneezee authored and codebien committed Sep 19, 2023
1 parent 81005d8 commit 6b03089
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions converter/har/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,11 @@ func Convert(h HAR, options lib.Options, minSleep, maxSleep uint, enableChecks b
}
}

if e.Response.Headers != nil {
for _, header := range e.Response.Headers {
if header.Name == "Location" {
fprintf(w, "\t\tredirectUrl = res.headers.Location;\n")
recordedRedirectURL = header.Value
break
}
for _, header := range e.Response.Headers {
if header.Name == "Location" {
fprintf(w, "\t\tredirectUrl = res.headers.Location;\n")
recordedRedirectURL = header.Value
break
}
}

Expand Down

0 comments on commit 6b03089

Please sign in to comment.