Skip to content

Commit

Permalink
Merge pull request #1479 from getlantern/thomas/issue-header
Browse files Browse the repository at this point in the history
add headers to issue request
  • Loading branch information
thomasjib authored Jan 17, 2025
2 parents 51d97ee + 187f97b commit 5b62deb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions issue/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func SendReport(
country string,
) (err error) {
return sendReport(
userConfig,
userConfig.GetDeviceID(),
strconv.Itoa(int(userConfig.GetUserID())),
userConfig.GetToken(),
Expand All @@ -63,6 +64,7 @@ func SendReport(
}

func sendReport(
userConfig common.UserConfig,
deviceID string,
userID string,
proToken string,
Expand Down Expand Up @@ -144,6 +146,10 @@ func sendReport(
}
req.Header.Set("content-type", "application/x-protobuf")

common.AddCommonNonUserHeaders(userConfig, req)

log.Debugf("issue 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)
Expand Down
7 changes: 6 additions & 1 deletion issue/issue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -53,15 +54,19 @@ 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,
"34qsdf-24qsadf-32542q",
"1",
"token",
"en",
int(Request_NO_ACCESS),
"Description placeholder",
"pro",
"jay[email protected]",
"thomas[email protected]",
"7.1.1",
"Samsung Galaxy S10",
"SM-G973F",
Expand Down

0 comments on commit 5b62deb

Please sign in to comment.