Skip to content

Commit

Permalink
Fix previous commit:
Browse files Browse the repository at this point in the history
* remove the (now unused) recordedRestID variable
* reintroduce accidentally removed redirect detection.
  • Loading branch information
Lars Holmberg committed Apr 19, 2018
1 parent 681a765 commit 445e0d3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
3 changes: 2 additions & 1 deletion cmd/testdata/example.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions converter/har/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ func Convert(h HAR, enableChecks bool, returnOnFailedCheck bool, batchTime uint,

if nobatch {
var recordedRedirectURL string
var recordedRestID string
previousResponse := map[string]interface{}{}

fmt.Fprint(w, "\t\tlet res, redirectUrl, json;\n")
Expand Down Expand Up @@ -140,11 +139,7 @@ func Convert(h HAR, enableChecks bool, returnOnFailedCheck bool, batchTime uint,
fmt.Fprintf(w, "redirectUrl")
recordedRedirectURL = ""
} else {
if recordedRestID != "" && strings.Contains(e.Request.URL, recordedRestID) {
fmt.Fprintf(w, "`%s`", strings.Replace(e.Request.URL, recordedRestID, "${restID}", -1))
} else {
fmt.Fprintf(w, "%q", e.Request.URL)
}
fmt.Fprintf(w, "%q", e.Request.URL)
}

if e.Request.Method != "GET" {
Expand Down Expand Up @@ -191,6 +186,16 @@ func Convert(h HAR, enableChecks bool, returnOnFailedCheck bool, batchTime uint,
}
}

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

responseMimeType := e.Response.Content.MimeType
if correlate &&
strings.Index(responseMimeType, "application/") == 0 &&
Expand Down

0 comments on commit 445e0d3

Please sign in to comment.