From 4d55c62b9caaf079278f89c8327c12838e253da3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 16:07:42 -0500 Subject: [PATCH 1/3] chore(deps): bump github.com/golang-jwt/jwt/v4 from 4.5.0 to 4.5.1 (#651) * [chore] Release 4.12.0 (#561) - Release 4.12.0 * Revert "[chore] Release 4.12.0 (#561)" (#565) This reverts commit 32af2b8141bddb7230dd4db7e6612703f2dfc25b. * chore(deps): bump github.com/golang-jwt/jwt/v4 from 4.5.0 to 4.5.1 Bumps [github.com/golang-jwt/jwt/v4](https://github.com/golang-jwt/jwt) from 4.5.0 to 4.5.1. - [Release notes](https://github.com/golang-jwt/jwt/releases) - [Changelog](https://github.com/golang-jwt/jwt/blob/main/VERSION_HISTORY.md) - [Commits](https://github.com/golang-jwt/jwt/compare/v4.5.0...v4.5.1) --- updated-dependencies: - dependency-name: github.com/golang-jwt/jwt/v4 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: Google Open Source Bot <26440463+google-oss-bot@users.noreply.github.com> Co-authored-by: Lahiru Maramba Co-authored-by: Google Open Source Bot Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index b9a1c22c..e0f41979 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( cloud.google.com/go/firestore v1.15.0 cloud.google.com/go/storage v1.40.0 github.com/MicahParks/keyfunc v1.9.0 - github.com/golang-jwt/jwt/v4 v4.5.0 + github.com/golang-jwt/jwt/v4 v4.5.1 github.com/google/go-cmp v0.6.0 golang.org/x/oauth2 v0.18.0 google.golang.org/api v0.170.0 diff --git a/go.sum b/go.sum index 3793c744..1a275d74 100644 --- a/go.sum +++ b/go.sum @@ -34,8 +34,8 @@ github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ4 github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo= +github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= @@ -65,6 +65,7 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= +github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -84,6 +85,7 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= @@ -96,6 +98,7 @@ go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= go.opentelemetry.io/otel/sdk v1.22.0 h1:6coWHw9xw7EfClIC/+O31R8IY3/+EiRFHevmHafB2Gw= +go.opentelemetry.io/otel/sdk v1.22.0/go.mod h1:iu7luyVGYovrRpe2fmj3CVKouQNdTOkxtLzPvPz1DOc= go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -159,6 +162,7 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= google.golang.org/api v0.170.0 h1:zMaruDePM88zxZBG+NG8+reALO2rfLhe/JShitLyT48= google.golang.org/api v0.170.0/go.mod h1:/xql9M2btF85xac/VAm4PsLMTLVGUOpq4BE9R8jyNy8= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= From 4ff081234af2890ecdec649e45273c0818315e47 Mon Sep 17 00:00:00 2001 From: Jonathan Edey <145066863+jonathanedey@users.noreply.github.com> Date: Thu, 21 Nov 2024 13:39:28 -0500 Subject: [PATCH 2/3] chore: Add `X-Goog-Api-Client` metric header to outgoing requests (#655) * chore: Add `X-Goog-Api-Client` metric header to outgoing requests * Fix lint and test * Remove App Check headers --- auth/auth.go | 4 +--- auth/auth_test.go | 9 +++------ auth/token_generator.go | 3 +++ auth/token_generator_test.go | 13 +++++++++++-- auth/user_mgt_test.go | 3 +-- firebase.go | 1 + iid/iid.go | 3 +++ iid/iid_test.go | 13 +++++++++++++ internal/http_client.go | 8 ++++++++ internal/internal.go | 1 + messaging/messaging.go | 6 ++---- messaging/messaging_test.go | 5 +---- messaging/topic_mgt.go | 7 +++++-- messaging/topic_mgt_test.go | 5 +++++ 14 files changed, 58 insertions(+), 23 deletions(-) diff --git a/auth/auth.go b/auth/auth.go index 0bda04a0..a7028698 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -21,7 +21,6 @@ import ( "errors" "fmt" "os" - "runtime" "strings" "time" @@ -134,12 +133,11 @@ func NewClient(ctx context.Context, conf *internal.AuthConfig) (*Client, error) return nil, err } - goVersion := strings.TrimPrefix(runtime.Version(), "go") hc := internal.WithDefaultRetryConfig(transport) hc.CreateErrFn = handleHTTPError hc.Opts = []internal.HTTPOption{ internal.WithHeader("X-Client-Version", fmt.Sprintf("Go/Admin/%s", conf.Version)), - internal.WithHeader("x-goog-api-client", fmt.Sprintf("gl-go/%s fire-admin/%s", goVersion, conf.Version)), + internal.WithHeader("x-goog-api-client", internal.GetMetricsHeader(conf.Version)), } baseURL := defaultAuthURL diff --git a/auth/auth_test.go b/auth/auth_test.go index 2a00220b..9c8b1523 100644 --- a/auth/auth_test.go +++ b/auth/auth_test.go @@ -23,7 +23,6 @@ import ( "log" "net/http" "os" - "runtime" "strings" "syscall" "testing" @@ -1452,11 +1451,9 @@ func checkBaseClient(client *Client, wantProjectID string) error { return fmt.Errorf("version = %q; want = %q", version, wantVersion) } - goVersion := strings.TrimPrefix(runtime.Version(), "go") - xGoogAPIClientHeader := req.Header.Get("x-goog-api-client") - wantXGoogAPIClientHeader := fmt.Sprintf("gl-go/%s fire-admin/%s", goVersion, testVersion) - if xGoogAPIClientHeader != wantXGoogAPIClientHeader { - return fmt.Errorf("x-goog-api-client header = %q; want = %q", xGoogAPIClientHeader, wantXGoogAPIClientHeader) + xGoogAPIClientHeader := internal.GetMetricsHeader(testVersion) + if h := req.Header.Get("x-goog-api-client"); h != xGoogAPIClientHeader { + return fmt.Errorf("x-goog-api-client header = %q; want = %q", h, xGoogAPIClientHeader) } return nil diff --git a/auth/token_generator.go b/auth/token_generator.go index 0e18b8c8..7aa2d564 100644 --- a/auth/token_generator.go +++ b/auth/token_generator.go @@ -175,6 +175,9 @@ func newIAMSigner(ctx context.Context, config *internal.AuthConfig) (*iamSigner, if err != nil { return nil, err } + hc.Opts = []internal.HTTPOption{ + internal.WithHeader("x-goog-api-client", internal.GetMetricsHeader(config.Version)), + } return &iamSigner{ mutex: &sync.Mutex{}, diff --git a/auth/token_generator_test.go b/auth/token_generator_test.go index c80c4dea..c79e3a9a 100644 --- a/auth/token_generator_test.go +++ b/auth/token_generator_test.go @@ -122,6 +122,7 @@ func TestIAMSigner(t *testing.T) { conf := &internal.AuthConfig{ Opts: optsWithTokenSource, ServiceAccountID: "test-service-account", + Version: testVersion, } signer, err := newIAMSigner(ctx, conf) if err != nil { @@ -155,6 +156,7 @@ func TestIAMSignerHTTPError(t *testing.T) { conf := &internal.AuthConfig{ Opts: optsWithTokenSource, ServiceAccountID: "test-service-account", + Version: testVersion, } signer, err := newIAMSigner(context.Background(), conf) if err != nil { @@ -182,6 +184,7 @@ func TestIAMSignerUnknownHTTPError(t *testing.T) { conf := &internal.AuthConfig{ Opts: optsWithTokenSource, ServiceAccountID: "test-service-account", + Version: testVersion, } signer, err := newIAMSigner(context.Background(), conf) if err != nil { @@ -208,7 +211,8 @@ func TestIAMSignerUnknownHTTPError(t *testing.T) { func TestIAMSignerWithMetadataService(t *testing.T) { ctx := context.Background() conf := &internal.AuthConfig{ - Opts: optsWithTokenSource, + Opts: optsWithTokenSource, + Version: testVersion, } signer, err := newIAMSigner(ctx, conf) @@ -253,7 +257,8 @@ func TestIAMSignerWithMetadataService(t *testing.T) { func TestIAMSignerNoMetadataService(t *testing.T) { ctx := context.Background() conf := &internal.AuthConfig{ - Opts: optsWithTokenSource, + Opts: optsWithTokenSource, + Version: testVersion, } signer, err := newIAMSigner(ctx, conf) @@ -340,6 +345,10 @@ func iamServer(t *testing.T, serviceAcct, signature string) *httptest.Server { if r.URL.Path != wantPath { t.Errorf("Path = %q; want = %q", r.URL.Path, wantPath) } + xGoogAPIClientHeader := internal.GetMetricsHeader(testVersion) + if h := r.Header.Get("x-goog-api-client"); h != xGoogAPIClientHeader { + t.Errorf("x-goog-api-client header = %q; want = %q", h, xGoogAPIClientHeader) + } w.Header().Set("Content-Type", "application/json") b, err := json.Marshal(resp) diff --git a/auth/user_mgt_test.go b/auth/user_mgt_test.go index 902ed280..97e64c39 100644 --- a/auth/user_mgt_test.go +++ b/auth/user_mgt_test.go @@ -24,7 +24,6 @@ import ( "net/http" "net/http/httptest" "reflect" - "runtime" "sort" "strconv" "strings" @@ -2317,7 +2316,7 @@ func echoServer(resp interface{}, t *testing.T) *mockAuthServer { } gh = r.Header.Get("x-goog-api-client") - wh = fmt.Sprintf("gl-go/%s fire-admin/%s", strings.TrimPrefix(runtime.Version(), "go"), testVersion) + wh = internal.GetMetricsHeader(testVersion) if gh != wh { t.Errorf("x-goog-api-client header = %q; want: %q", gh, wh) } diff --git a/firebase.go b/firebase.go index 8b1facd4..98e04a07 100644 --- a/firebase.go +++ b/firebase.go @@ -115,6 +115,7 @@ func (a *App) InstanceID(ctx context.Context) (*iid.Client, error) { conf := &internal.InstanceIDConfig{ ProjectID: a.projectID, Opts: a.opts, + Version: Version, } return iid.NewClient(ctx, conf) } diff --git a/iid/iid.go b/iid/iid.go index 96486a6a..7a3e9b55 100644 --- a/iid/iid.go +++ b/iid/iid.go @@ -119,6 +119,9 @@ func NewClient(ctx context.Context, c *internal.InstanceIDConfig) (*Client, erro if err != nil { return nil, err } + hc.Opts = []internal.HTTPOption{ + internal.WithHeader("x-goog-api-client", internal.GetMetricsHeader(c.Version)), + } hc.CreateErrFn = createError return &Client{ diff --git a/iid/iid_test.go b/iid/iid_test.go index c9134207..208da357 100644 --- a/iid/iid_test.go +++ b/iid/iid_test.go @@ -31,6 +31,7 @@ var testIIDConfig = &internal.InstanceIDConfig{ Opts: []option.ClientOption{ option.WithTokenSource(&internal.MockTokenSource{AccessToken: "test-token"}), }, + Version: "test-version", } func TestNoProjectID(t *testing.T) { @@ -83,6 +84,10 @@ func TestDeleteInstanceID(t *testing.T) { if h := tr.Header.Get("Authorization"); h != "Bearer test-token" { t.Errorf("Authorization = %q; want = %q", h, "Bearer test-token") } + xGoogAPIClientHeader := internal.GetMetricsHeader(testIIDConfig.Version) + if h := tr.Header.Get("x-goog-api-client"); h != xGoogAPIClientHeader { + t.Errorf("x-goog-api-client header = %q; want = %q", h, xGoogAPIClientHeader) + } } func TestDeleteInstanceIDError(t *testing.T) { @@ -156,6 +161,10 @@ func TestDeleteInstanceIDError(t *testing.T) { if h := tr.Header.Get("Authorization"); h != "Bearer test-token" { t.Errorf("Authorization = %q; want = %q", h, "Bearer test-token") } + xGoogAPIClientHeader := internal.GetMetricsHeader(testIIDConfig.Version) + if h := tr.Header.Get("x-goog-api-client"); h != xGoogAPIClientHeader { + t.Errorf("x-goog-api-client header = %q; want = %q", h, xGoogAPIClientHeader) + } tr = nil } } @@ -201,6 +210,10 @@ func TestDeleteInstanceIDUnexpectedError(t *testing.T) { if h := tr.Header.Get("Authorization"); h != "Bearer test-token" { t.Errorf("Authorization = %q; want = %q", h, "Bearer test-token") } + xGoogAPIClientHeader := internal.GetMetricsHeader(testIIDConfig.Version) + if h := tr.Header.Get("x-goog-api-client"); h != xGoogAPIClientHeader { + t.Errorf("x-goog-api-client header = %q; want = %q", h, xGoogAPIClientHeader) + } } func TestDeleteInstanceIDConnectionError(t *testing.T) { diff --git a/internal/http_client.go b/internal/http_client.go index 280aecc4..9463f98e 100644 --- a/internal/http_client.go +++ b/internal/http_client.go @@ -23,7 +23,9 @@ import ( "io/ioutil" "math" "net/http" + "runtime" "strconv" + "strings" "time" "google.golang.org/api/option" @@ -441,3 +443,9 @@ func retryNetworkAndHTTPErrors(statusCodes ...int) RetryCondition { return false } } + +// GetMetricsHeader constructs header value for metrics attribution +func GetMetricsHeader(sdkVersion string) string { + goVersion := strings.TrimPrefix(runtime.Version(), "go") + return fmt.Sprintf("gl-go/%s fire-admin/%s", goVersion, sdkVersion) +} diff --git a/internal/internal.go b/internal/internal.go index 287391c5..9fb9e726 100644 --- a/internal/internal.go +++ b/internal/internal.go @@ -50,6 +50,7 @@ type HashConfig map[string]interface{} type InstanceIDConfig struct { Opts []option.ClientOption ProjectID string + Version string } // DatabaseConfig represents the configuration of Firebase Database service. diff --git a/messaging/messaging.go b/messaging/messaging.go index 525cccb6..dcd412c3 100644 --- a/messaging/messaging.go +++ b/messaging/messaging.go @@ -23,7 +23,6 @@ import ( "fmt" "net/http" "regexp" - "runtime" "strconv" "strings" "time" @@ -878,7 +877,7 @@ func NewClient(ctx context.Context, c *internal.MessagingConfig) (*Client, error return &Client{ fcmClient: newFCMClient(hc, c, messagingEndpoint, batchEndpoint), - iidClient: newIIDClient(hc), + iidClient: newIIDClient(hc, c), }, nil } @@ -894,12 +893,11 @@ func newFCMClient(hc *http.Client, conf *internal.MessagingConfig, messagingEndp client := internal.WithDefaultRetryConfig(hc) client.CreateErrFn = handleFCMError - goVersion := strings.TrimPrefix(runtime.Version(), "go") version := fmt.Sprintf("fire-admin-go/%s", conf.Version) client.Opts = []internal.HTTPOption{ internal.WithHeader(apiFormatVersionHeader, apiFormatVersion), internal.WithHeader(firebaseClientHeader, version), - internal.WithHeader("x-goog-api-client", fmt.Sprintf("gl-go/%s fire-admin/%s", goVersion, conf.Version)), + internal.WithHeader("x-goog-api-client", internal.GetMetricsHeader(conf.Version)), } return &fcmClient{ diff --git a/messaging/messaging_test.go b/messaging/messaging_test.go index 8b31fc46..dceed542 100644 --- a/messaging/messaging_test.go +++ b/messaging/messaging_test.go @@ -21,8 +21,6 @@ import ( "net/http" "net/http/httptest" "reflect" - "runtime" - "strings" "testing" "time" @@ -1396,8 +1394,7 @@ func checkFCMRequest(t *testing.T, b []byte, tr *http.Request, want map[string]i if h := tr.Header.Get("X-FIREBASE-CLIENT"); h != clientVersion { t.Errorf("X-FIREBASE-CLIENT = %q; want = %q", h, clientVersion) } - goVersion := strings.TrimPrefix(runtime.Version(), "go") - xGoogAPIClientHeader := "gl-go/" + goVersion + " fire-admin/" + testMessagingConfig.Version + xGoogAPIClientHeader := internal.GetMetricsHeader(testMessagingConfig.Version) if h := tr.Header.Get("x-goog-api-client"); h != xGoogAPIClientHeader { t.Errorf("x-goog-api-client header = %q; want = %q", h, xGoogAPIClientHeader) } diff --git a/messaging/topic_mgt.go b/messaging/topic_mgt.go index 15a29787..88492585 100644 --- a/messaging/topic_mgt.go +++ b/messaging/topic_mgt.go @@ -63,10 +63,13 @@ type iidClient struct { httpClient *internal.HTTPClient } -func newIIDClient(hc *http.Client) *iidClient { +func newIIDClient(hc *http.Client, conf *internal.MessagingConfig) *iidClient { client := internal.WithDefaultRetryConfig(hc) client.CreateErrFn = handleIIDError - client.Opts = []internal.HTTPOption{internal.WithHeader("access_token_auth", "true")} + client.Opts = []internal.HTTPOption{ + internal.WithHeader("access_token_auth", "true"), + internal.WithHeader("x-goog-api-client", internal.GetMetricsHeader(conf.Version)), + } return &iidClient{ iidEndpoint: iidEndpoint, httpClient: client, diff --git a/messaging/topic_mgt_test.go b/messaging/topic_mgt_test.go index 15ea45d1..6d58114d 100644 --- a/messaging/topic_mgt_test.go +++ b/messaging/topic_mgt_test.go @@ -25,6 +25,7 @@ import ( "testing" "firebase.google.com/go/v4/errorutils" + "firebase.google.com/go/v4/internal" ) func TestSubscribe(t *testing.T) { @@ -198,6 +199,10 @@ func checkIIDRequest(t *testing.T, b []byte, tr *http.Request, op string) { if h := tr.Header.Get("Authorization"); h != "Bearer test-token" { t.Errorf("Authorization = %q; want = %q", h, "Bearer test-token") } + xGoogAPIClientHeader := internal.GetMetricsHeader(testMessagingConfig.Version) + if h := tr.Header.Get("x-goog-api-client"); h != xGoogAPIClientHeader { + t.Errorf("x-goog-api-client header = %q; want = %q", h, xGoogAPIClientHeader) + } } func checkTopicMgtResponse(t *testing.T, resp *TopicManagementResponse) { From f682329088fdd5facbefdfe46b323e8f57eb10de Mon Sep 17 00:00:00 2001 From: Jonathan Edey <145066863+jonathanedey@users.noreply.github.com> Date: Thu, 5 Dec 2024 12:29:17 -0500 Subject: [PATCH 3/3] [chore] Release 4.15.1 (#660) --- firebase.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firebase.go b/firebase.go index 98e04a07..7b97aac1 100644 --- a/firebase.go +++ b/firebase.go @@ -39,7 +39,7 @@ import ( var defaultAuthOverrides = make(map[string]interface{}) // Version of the Firebase Go Admin SDK. -const Version = "4.15.0" +const Version = "4.15.1" // firebaseEnvName is the name of the environment variable with the Config. const firebaseEnvName = "FIREBASE_CONFIG"