From 45fd347ee3bbf3d1d30d1d6fc30c1dcaff167a89 Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Thu, 12 Jun 2025 07:14:52 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/e2e/src/http-fixtures.ts | 13 ++++++++++++- apps/gateway/src/lib/update-origin-request.ts | 16 +++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/apps/e2e/src/http-fixtures.ts b/apps/e2e/src/http-fixtures.ts index 1b571ddb..b7ec251c 100644 --- a/apps/e2e/src/http-fixtures.ts +++ b/apps/e2e/src/http-fixtures.ts @@ -632,12 +632,23 @@ export const fixtureSuites: E2ETestFixtureSuite[] = [ snapshot: false, fixtures: [ { - path: '@dev/test-everything-openapi/echo_headers', + path: '@dev/test-everything-openapi@ee3b9fdc/echo_headers', response: { validate: (body) => { expect(body['x-agentic-proxy-secret']).toEqual( 'f279280a67a15df6e0245511bdeb11854fc8f6f702c49d028431bb1dbc03bfdc' ) + expect(body['x-agentic-deployment-id']).toEqual( + 'depl_yhc7f8gubcqycagjp68c4ozr' + ) + expect(body['x-agentic-deployment-identifier']).toEqual( + '@dev/test-everything-openapi@ee3b9fdc' + ) + expect(body['x-agentic-is-customer-subscription-active']).toEqual( + 'false' + ) + expect(body['x-agentic-user-id']).toBeUndefined() + expect(body['x-agentic-customer-id']).toBeUndefined() } } } diff --git a/apps/gateway/src/lib/update-origin-request.ts b/apps/gateway/src/lib/update-origin-request.ts index 953b7031..bbf5b763 100644 --- a/apps/gateway/src/lib/update-origin-request.ts +++ b/apps/gateway/src/lib/update-origin-request.ts @@ -66,13 +66,17 @@ export function updateOriginRequest( consumer.stripeStatus ) - originRequest.headers.set('x-agentic-user', consumer.user.id) + originRequest.headers.set('x-agentic-user-id', consumer.user.id) originRequest.headers.set('x-agentic-user-email', consumer.user.email) originRequest.headers.set('x-agentic-user-username', consumer.user.username) originRequest.headers.set( 'x-agentic-user-created-at', consumer.user.createdAt ) + originRequest.headers.set( + 'x-agentic-user-updated-at', + consumer.user.updatedAt + ) if (consumer.plan) { originRequest.headers.set( @@ -84,6 +88,11 @@ export function updateOriginRequest( if (consumer.user.name) { originRequest.headers.set('x-agentic-user-name', consumer.user.name) } + } else { + originRequest.headers.set( + 'x-agentic-is-customer-subscription-active', + 'false' + ) } // TODO: this header is causing some random upstream cloudflare errors @@ -94,5 +103,10 @@ export function updateOriginRequest( originRequest.headers.set('cache-control', cacheControl) } + originRequest.headers.set('x-agentic-deployment-id', deployment.id) + originRequest.headers.set( + 'x-agentic-deployment-identifier', + deployment.identifier + ) originRequest.headers.set('x-agentic-proxy-secret', deployment._secret) }