feature!: support for setting HTTP User-Agent header (#157)
* feature!: support for setting HTTP User-Agent header * fix lint * fix e2e * refactor: move http.go to internal/util/useragent package and rename functions to Get and Set * Move packages and use attest version
This commit is contained in:
19
internal/useragent/useragent_test.go
Normal file
19
internal/useragent/useragent_test.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package useragent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// test the user agent setting and getting.
|
||||
func TestSetUserAgent(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
if Get(ctx) != defaultUserAgent {
|
||||
t.Errorf("expected user agent to be '%s', got %q", defaultUserAgent, Get(ctx))
|
||||
}
|
||||
|
||||
ctx = Set(ctx, "test-agent")
|
||||
if Get(ctx) != "test-agent" {
|
||||
t.Errorf("expected user agent to be 'test-agent', got %q", Get(ctx))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user