add the user-agent header

This commit is contained in:
rahul agrawal
2019-10-23 16:31:59 +05:30
parent 4bb2a435ae
commit 0000173c05
2 changed files with 5 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ package appclient
import (
"compress/gzip"
"fmt"
"github.com/weaveworks/scope/app"
"net/http"
"net/http/httptest"
"net/url"
@@ -32,6 +33,9 @@ func dummyServer(t *testing.T, expectedToken, expectedID string, expectedVersion
t.Errorf("want %q, have %q", expectedID, have)
}
if have := r.Header.Get("user-agent"); "Scope/1.11.6" != have {
t.Errorf("want %q, have %q", app.Version, have)
}
var have report.Report
reader := r.Body

View File

@@ -46,6 +46,7 @@ func (pc ProbeConfig) authorizeHeaders(headers http.Header) {
}
headers.Set(xfer.ScopeProbeIDHeader, pc.ProbeID)
headers.Set(xfer.ScopeProbeVersionHeader, pc.ProbeVersion)
headers.Set("user-agent","Scope/1.11.6")
}
func (pc ProbeConfig) authorizedRequest(method string, urlStr string, body io.Reader) (*http.Request, error) {