Skip to content

Commit 454ac33

Browse files
committed
style(client): format streamable HTTP 404 session recovery changes
1 parent 7158bd5 commit 454ac33

2 files changed

Lines changed: 5 additions & 16 deletions

File tree

packages/client/src/client/streamableHttp.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ function markSessionBound404Error(error: Error): Error {
3535
}
3636

3737
function isSessionBound404Error(error: unknown): boolean {
38-
return Boolean(
39-
error &&
40-
typeof error === 'object' &&
41-
(error as SessionBound404Error)[SESSION_BOUND_404_ERROR] === true
42-
);
38+
return Boolean(error && typeof error === 'object' && (error as SessionBound404Error)[SESSION_BOUND_404_ERROR] === true);
4339
}
4440

4541
/**
@@ -272,8 +268,7 @@ export class StreamableHTTPClientTransport implements Transport {
272268
});
273269

274270
if (!response.ok) {
275-
const shouldClearSessionFor404 =
276-
response.status === 404 && sentSessionId !== null && this._sessionId === sentSessionId;
271+
const shouldClearSessionFor404 = response.status === 404 && sentSessionId !== null && this._sessionId === sentSessionId;
277272
if (shouldClearSessionFor404) {
278273
this._sessionId = undefined;
279274
}
@@ -312,14 +307,10 @@ export class StreamableHTTPClientTransport implements Transport {
312307
return;
313308
}
314309

315-
const error = new SdkError(
316-
SdkErrorCode.ClientHttpFailedToOpenStream,
317-
`Failed to open SSE stream: ${response.statusText}`,
318-
{
310+
const error = new SdkError(SdkErrorCode.ClientHttpFailedToOpenStream, `Failed to open SSE stream: ${response.statusText}`, {
319311
status: response.status,
320312
statusText: response.statusText
321-
}
322-
);
313+
});
323314
throw shouldClearSessionFor404 ? markSessionBound404Error(error) : error;
324315
}
325316

packages/client/test/client/streamableHttp.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,7 @@ describe('StreamableHTTPClientTransport', () => {
455455
return deferredFetch;
456456
});
457457

458-
const startPromise = (
459-
transport as unknown as { _startOrAuthSse: (opts: StartSSEOptions) => Promise<void> }
460-
)._startOrAuthSse({});
458+
const startPromise = (transport as unknown as { _startOrAuthSse: (opts: StartSSEOptions) => Promise<void> })._startOrAuthSse({});
461459

462460
resolveFetch({
463461
ok: false,

0 commit comments

Comments
 (0)