Merge pull request #3720 from DarthSett/master

Adding the "user-agent" Header
This commit is contained in:
Bryan Boreham
2019-11-26 11:19:36 +00:00
committed by GitHub
2 changed files with 8 additions and 1 deletions
+5 -1
View File
@@ -29,7 +29,11 @@ func dummyServer(t *testing.T, expectedToken, expectedID string, expectedVersion
}
if have := r.Header.Get(xfer.ScopeProbeVersionHeader); expectedVersion != have {
t.Errorf("want %q, have %q", expectedID, have)
t.Errorf("want %q, have %q", expectedVersion, have)
}
if have := r.Header.Get("user-agent"); "Scope_Probe/"+expectedVersion!=have {
t.Errorf("want %q, have %q","Scope_Probe/"+expectedVersion,have)
}
var have report.Report
+3
View File
@@ -46,6 +46,9 @@ func (pc ProbeConfig) authorizeHeaders(headers http.Header) {
}
headers.Set(xfer.ScopeProbeIDHeader, pc.ProbeID)
headers.Set(xfer.ScopeProbeVersionHeader, pc.ProbeVersion)
headers.Set("user-agent","Scope_Probe/"+pc.ProbeVersion )
}
func (pc ProbeConfig) authorizedRequest(method string, urlStr string, body io.Reader) (*http.Request, error) {