Closed mdb closed 4 years ago
I'd suggest adding the following test to util_test.go
:
func TestResourceRequest(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.UserAgent() != defaultUA() {
t.Error("default user agent not set")
}
}))
defer ts.Close()
c := NewClient(ClientConfiguration{Host: ts.URL})
resourceRequest(c, ts.URL, http.MethodGet, nil, nil)
}
Thanks @nmische ! Also, @pauljamescleary was able to confirm that go-vinyldns
is behaving as expected and the VinylDNS API behavior outlined above is a bug fixed via VinylDNS PR 894.
This seeks to address issue #67.
However, it appears to me that, when tested against a local VinylDNS API, VinylDNS still does not log the
go-vinyldns
-setUser-Agent
header, despite that...User-Agent
header set by other clients, such as vinyldns-jsgo-vinyldns
that issues aZones()
request tohttp://httpbin.org/user-agent
rather than the VinylDNS API (using a technique similar to that outlined here, I do see the expected{ "user-agent": "go-vinyldns/0.9.10" }
response body, thus suggesting theUser-Agent
header is being sent correctly.Am I confused or is it possible that VinylDNS dislikes some aspect of the
go-vinyldns
request and/or itsUser-Agent
header?