From e6c241f11277a57dfcba51e264721faa8c880124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D1=83=D1=87=D0=BA=D0=BE=D0=B2=20=D0=90=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D0=B9=20=D0=9F=D0=B0=D0=B2=D0=BB=D0=BE=D0=B2=D0=B8?= =?UTF-8?q?=D1=87?= Date: Tue, 13 Jan 2026 18:13:05 +0300 Subject: [PATCH] MSP-7007 add x-application-name to header --- proxy/grpc.go | 1 + proxy/http.go | 1 + tests/acceptance_test.go | 2 ++ 3 files changed, 4 insertions(+) diff --git a/proxy/grpc.go b/proxy/grpc.go index 04f4b35..7f5326e 100644 --- a/proxy/grpc.go +++ b/proxy/grpc.go @@ -83,6 +83,7 @@ func (p Grpc) Handle(ctx *request.Context) error { md[grpc.DomainIdHeader] = []string{strconv.Itoa(authData.DomainId)} md[grpc.ServiceIdHeader] = []string{strconv.Itoa(authData.ServiceId)} md[grpc.ApplicationIdHeader] = []string{strconv.Itoa(authData.ApplicationId)} + md[xAppNameHeader] = []string{authData.AppName} if ctx.IsAdminAuthenticated() { md[xAdminIdHeader] = []string{strconv.Itoa(ctx.AdminId())} } diff --git a/proxy/http.go b/proxy/http.go index 4581202..488c441 100644 --- a/proxy/http.go +++ b/proxy/http.go @@ -100,6 +100,7 @@ func setHttpHeaders(ctx *request.Context, header http.Header, skipAuth bool) err header.Set(grpc.DomainIdHeader, strconv.Itoa(authData.DomainId)) header.Set(grpc.ServiceIdHeader, strconv.Itoa(authData.ServiceId)) header.Set(grpc.ApplicationIdHeader, strconv.Itoa(authData.ApplicationId)) + header.Set(xAppNameHeader, authData.AppName) //nolint:canonicalheader if ctx.IsAdminAuthenticated() { header.Set(xAdminIdHeader, strconv.Itoa(ctx.AdminId())) //nolint:canonicalheader } else { diff --git a/tests/acceptance_test.go b/tests/acceptance_test.go index 7775a4e..36fdeab 100644 --- a/tests/acceptance_test.go +++ b/tests/acceptance_test.go @@ -324,6 +324,7 @@ func (s *HappyPathTestSuite) commonDependencies(test *test.Test) (conf.Remote, * DomainId: 2, ServiceId: 3, ApplicationId: 4, + AppName: "test", }, } }).Mock("system/secure/authorize", func() domain.AuthorizeResponse { @@ -366,6 +367,7 @@ func assertHeaders(require *require.Assertions, requestId string, ctx context.Co require.EqualValues(2, domainId) require.EqualValues(3, serviceId) require.EqualValues(4, applicationId) + require.EqualValues("test", headers.Get("x-application-name")) adminId, err := strconv.Atoi(headers.Get("x-admin-id")) require.NoError(err)