Skip to content

Commit

Permalink
fix: handle Response objects with empty string url in processDpopNonce
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Jan 7, 2024
1 parent 8785677 commit f2c9415
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -740,11 +740,14 @@ export interface DiscoveryRequestOptions extends HttpRequestOptions {
}

function processDpopNonce(response: Response) {
const url = new URL(response.url)
if (response.headers.has('dpop-nonce')) {
dpopNonces.set(url.origin, response.headers.get('dpop-nonce')!)
try {
if (response.headers.has('dpop-nonce')) {
const url = new URL(response.url)
dpopNonces.set(url.origin, response.headers.get('dpop-nonce')!)
}
} finally {
return response
}
return response
}

function normalizeTyp(value: string) {
Expand Down

0 comments on commit f2c9415

Please sign in to comment.