Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/core/src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2396,6 +2396,11 @@ type Infer<Schema extends z.ZodTypeAny> = Flatten<z.infer<Schema>>;
* Information about the incoming request.
*/
export interface RequestInfo {
/**
* The full request URL.
*/
url: string;

/**
* The headers of the request.
*/
Expand Down
12 changes: 10 additions & 2 deletions packages/middleware/node/test/streamableHttp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,10 @@ describe('Zod v4', () => {
id: 'call-1'
};

const response = await sendPostRequest(baseUrl, toolCallMessage, sessionId);
const requestUrl = new URL(baseUrl);
requestUrl.searchParams.set('tenant', 'acme-corp');

const response = await sendPostRequest(requestUrl, toolCallMessage, sessionId);
expect(response.status).toBe(200);

const text = await readSSEEvent(response);
Expand Down Expand Up @@ -409,6 +412,7 @@ describe('Zod v4', () => {
// Convert Headers object to plain object for JSON serialization
// Headers is a Web API class that doesn't serialize with JSON.stringify
const serializedRequestInfo = {
url: ctx.http?.req?.url,
headers: Object.fromEntries(ctx.http?.req?.headers ?? new Headers())
};
return {
Expand All @@ -432,7 +436,10 @@ describe('Zod v4', () => {
id: 'call-1'
};

const response = await sendPostRequest(baseUrl, toolCallMessage, sessionId);
const requestUrl = new URL(baseUrl);
requestUrl.searchParams.set('tenant', 'acme-corp');

const response = await sendPostRequest(requestUrl, toolCallMessage, sessionId);
expect(response.status).toBe(200);

const text = await readSSEEvent(response);
Expand All @@ -455,6 +462,7 @@ describe('Zod v4', () => {

const requestInfo = JSON.parse(eventData.result.content[1].text);
expect(requestInfo).toMatchObject({
url: requestUrl.toString(),
headers: {
'content-type': 'application/json',
accept: 'application/json, text/event-stream',
Expand Down
1 change: 1 addition & 0 deletions packages/server/src/server/streamableHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ export class WebStandardStreamableHTTPServerTransport implements Transport {

// Build request info from headers
const requestInfo: RequestInfo = {
url: req.url,
headers: req.headers
};

Expand Down
Loading