Skip to content

Commit eb5d0ae

Browse files
committed
Use standard User-Agent header instead of X-UC-User-Agent
X-UC-User-Agent is a CORS-allowed custom header designed for the JavaScript upload widget running in browsers, where overriding the browser's built-in User-Agent is restricted. Server-side SDKs have no such restriction. All other Uploadcare server-side SDKs (Python, PHP, Ruby, Java) use the standard User-Agent header. The Go SDK adopted X-UC-User-Agent in 2019 without clear justification.
1 parent 9e5e84b commit eb5d0ae

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ucare/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var (
2020
defaultAPIVersion = APIv07
2121

2222
authHeaderKey = http.CanonicalHeaderKey("Authorization")
23-
userAgentHeaderKey = http.CanonicalHeaderKey("X-UC-User-Agent")
23+
userAgentHeaderKey = http.CanonicalHeaderKey("User-Agent")
2424

2525
dateHeaderLocation = time.FixedZone("GMT", 0)
2626
)

ucare/restapi_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ func TestRESTAPIClient(t *testing.T) {
5757
"application/vnd.uploadcare-v0.7+json" {
5858
return errors.New("wrong accept header")
5959
}
60-
if h.Get("X-UC-User-Agent") !=
61-
"UploadcareGo/0.2.0/testpublickey" {
60+
if h.Get("User-Agent") !=
61+
"UploadcareGo/2.0.0/testpublickey" {
6262
return errors.New("wrong user-agent header")
6363
}
6464
if h.Get("Content-Type") != "application/json" {

0 commit comments

Comments
 (0)