From 88866695ed09b565c7c14258e8471f12e9829305 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 25 Nov 2024 14:59:49 +0000 Subject: [PATCH] Iterate based on review --- submit.go | 8 ++++---- submit_test.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/submit.go b/submit.go index 09b362c..1ef5c6a 100644 --- a/submit.go +++ b/submit.go @@ -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 @@ -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 { diff --git a/submit_test.go b/submit_test.go index 6c01fd6..6b9d464 100644 --- a/submit_test.go +++ b/submit_test.go @@ -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) } }