Skip to content

Commit

Permalink
Iterate based on review
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy committed Nov 25, 2024
1 parent 7266c23 commit 8886669
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ func parseJSONRequest(w http.ResponseWriter, req *http.Request, reportDir string
parsed.AppName = p.AppName

if p.UserAgent != "" {
parsed.Data["User-Agent"] = parseUserAgent(p.UserAgent)
parsed.Data["Raw-User-Agent"] = p.UserAgent
parsed.Data["Parsed-User-Agent"] = parseUserAgent(p.UserAgent)
parsed.Data["User-Agent"] = p.UserAgent
}
if p.Version != "" {
parsed.Data["Version"] = p.Version
Expand Down Expand Up @@ -433,8 +433,8 @@ func formPartToPayload(field, data string, p *payload) {
} else if field == "version" {
p.Data["Version"] = data
} else if field == "user_agent" {
p.Data["User-Agent"] = parseUserAgent(data)
p.Data["Raw-User-Agent"] = data
p.Data["User-Agent"] = data
p.Data["Parsed-User-Agent"] = parseUserAgent(data)
} else if field == "label" {
p.Labels = append(p.Labels, data)
} else {
Expand Down
4 changes: 2 additions & 2 deletions submit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ func TestParseUserAgent(t *testing.T) {
}

wanted := "Chrome 130.0.6723 on Windows 10 running on Other device"
if p.Data["User-Agent"] != wanted {
t.Errorf("user agent: got %s, want %s", p.Data["User-Agent"], wanted)
if p.Data["Parsed-User-Agent"] != wanted {
t.Errorf("user agent: got %s, want %s", p.Data["Parsed-User-Agent"], wanted)
}
}

0 comments on commit 8886669

Please sign in to comment.