Add user-agent header

This commit is contained in:
DarthSett
2019-10-25 12:33:35 +05:30
parent 7adc70c5a5
commit af31e30439
2 changed files with 4 additions and 6 deletions

View File

@@ -3,7 +3,6 @@ package appclient
import (
"compress/gzip"
"fmt"
"github.com/weaveworks/scope/app"
"net/http"
"net/http/httptest"
"net/url"
@@ -30,12 +29,9 @@ 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"); have != "Scope/1.11.6" {
t.Errorf("want %q, have %q", app.Version, have)
}
var have report.Report
reader := r.Body

View File

@@ -46,7 +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/1.11.6" )
headers.Set("user-agent","Probe_Scope/"+pc.ProbeVersion )
}
func (pc ProbeConfig) authorizedRequest(method string, urlStr string, body io.Reader) (*http.Request, error) {