From 3041f87e1522bdf8e705fd9e392553fb317d512c Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 16 Jan 2025 11:27:39 -0700 Subject: [PATCH 1/3] add headers to issue request --- issue/issue.go | 7 +++++++ issue/issue_test.go | 3 +++ 2 files changed, 10 insertions(+) diff --git a/issue/issue.go b/issue/issue.go index 9d10aea22..15a65afb3 100644 --- a/issue/issue.go +++ b/issue/issue.go @@ -45,6 +45,7 @@ func SendReport( country string, ) (err error) { return sendReport( + userConfig, userConfig.GetDeviceID(), strconv.Itoa(int(userConfig.GetUserID())), userConfig.GetToken(), @@ -63,6 +64,7 @@ func SendReport( } func sendReport( + userConfig common.UserConfig, deviceID string, userID string, proToken string, @@ -78,6 +80,7 @@ func sendReport( attachments []*Attachment, country string, ) error { + log.Debug("HERE") httpClient := &http.Client{ Transport: proxied.Fronted("issue_fronted_roundtrip"), } @@ -144,6 +147,10 @@ func sendReport( } req.Header.Set("content-type", "application/x-protobuf") + common.AddCommonNonUserHeaders(userConfig, req) + + log.Debugf("isssue sendReport X-lantern-version header: %v", req.Header.Get("X-Lantern-Version")) + resp, err := httpClient.Do(req) if err != nil { return log.Errorf("unable to send issue report: %v", err) diff --git a/issue/issue_test.go b/issue/issue_test.go index fbb55e6f2..1df2e35aa 100644 --- a/issue/issue_test.go +++ b/issue/issue_test.go @@ -7,6 +7,7 @@ import ( "gopkg.in/yaml.v2" + "github.com/getlantern/flashlight/v7/common" "github.com/getlantern/flashlight/v7/config" "github.com/getlantern/flashlight/v7/geolookup" "github.com/getlantern/flashlight/v7/proxied" @@ -53,7 +54,9 @@ func updateFronted() { func TestSendReport(t *testing.T) { updateFronted() + UserConfigData := common.UserConfigData{} err := sendReport( + &UserConfigData, "34qsdf-24qsadf-32542q", "1", "token", From 92e41ca5215258eac865977d044193cc566f6287 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 16 Jan 2025 11:31:56 -0700 Subject: [PATCH 2/3] remove extra log statement --- issue/issue.go | 1 - 1 file changed, 1 deletion(-) diff --git a/issue/issue.go b/issue/issue.go index 15a65afb3..5005b82b3 100644 --- a/issue/issue.go +++ b/issue/issue.go @@ -80,7 +80,6 @@ func sendReport( attachments []*Attachment, country string, ) error { - log.Debug("HERE") httpClient := &http.Client{ Transport: proxied.Fronted("issue_fronted_roundtrip"), } From 187f97b1e5f857388c61b2c5b103a8456ea7bd1a Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 16 Jan 2025 13:47:49 -0700 Subject: [PATCH 3/3] manually set lib version for test --- issue/issue.go | 2 +- issue/issue_test.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/issue/issue.go b/issue/issue.go index 5005b82b3..5d5583d47 100644 --- a/issue/issue.go +++ b/issue/issue.go @@ -148,7 +148,7 @@ func sendReport( common.AddCommonNonUserHeaders(userConfig, req) - log.Debugf("isssue sendReport X-lantern-version header: %v", req.Header.Get("X-Lantern-Version")) + log.Debugf("issue sendReport X-Lantern-Version header: %v", req.Header.Get("X-Lantern-Version")) resp, err := httpClient.Do(req) if err != nil { diff --git a/issue/issue_test.go b/issue/issue_test.go index 1df2e35aa..dc9f53888 100644 --- a/issue/issue_test.go +++ b/issue/issue_test.go @@ -54,6 +54,8 @@ func updateFronted() { func TestSendReport(t *testing.T) { updateFronted() + //manually set library version since its only populated when run from a binary + common.LibraryVersion = "7.0.0" UserConfigData := common.UserConfigData{} err := sendReport( &UserConfigData, @@ -64,7 +66,7 @@ func TestSendReport(t *testing.T) { int(Request_NO_ACCESS), "Description placeholder", "pro", - "jay+test@getlantern.org", + "thomas+test@getlantern.org", "7.1.1", "Samsung Galaxy S10", "SM-G973F",