Skip to content

Commit 3861bda

Browse files
jamietannaClaude Opus 5
andauthored
refactor(http): add a handleResponse hook (#45449)
As part of follow-up changes, we'll want to check the response's headers, which requires we have an additional hook that we can use. By default, this is a no-op. Co-authored-by: Claude Opus 5 <jamie.tanna+claude-code@mend.io>
1 parent 4eee9a4 commit 3861bda

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lib/util/http/http.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ export abstract class HttpBase<
242242
const resCopy = copyResponse(res, deepCopyNeeded);
243243
resCopy.authorization = !!options?.headers?.authorization;
244244

245+
this.handleResponse(resolvedUrl, resCopy);
246+
245247
if (cacheProvider) {
246248
return await cacheProvider.wrapServerResponse(method, url, resCopy);
247249
}
@@ -294,6 +296,10 @@ export abstract class HttpBase<
294296
throw err;
295297
}
296298

299+
protected handleResponse(_url: URL, _res: HttpResponse<unknown>): void {
300+
// noop
301+
}
302+
297303
resolveUrl(requestUrl: string | URL, options?: HttpOptions): URL {
298304
let url = requestUrl;
299305

0 commit comments

Comments
 (0)