Skip to content

Commit b90c11e

Browse files
committed
📦 NEW: Return headers from all endpoints of all primitives
1 parent fe14f97 commit b90c11e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/langbase/src/common/request.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,17 @@ export class Request {
6262
const isLllmGenerationEndpoint =
6363
GENERATION_ENDPOINTS.includes(endpoint);
6464

65+
// All endpoints should return headers if rawResponse is true
66+
if (!isLllmGenerationEndpoint && options.body?.rawResponse) {
67+
const responseData = await response.json();
68+
return {
69+
...responseData,
70+
rawResponse: {
71+
headers: Object.fromEntries(response.headers.entries()),
72+
},
73+
} as T;
74+
}
75+
6576
if (isLllmGenerationEndpoint) {
6677
const threadId = response.headers.get('lb-thread-id');
6778

0 commit comments

Comments
 (0)