Skip to content

Commit

Permalink
fix: pass url and body to badRequestResponse (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtPooki authored Apr 9, 2024
1 parent 6d0ffd8 commit cc228e6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/verified-fetch/src/verified-fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,17 @@ export class VerifiedFetch {
*/
private async handleIPNSRecord ({ resource, cid, path, options }: FetchHandlerFunctionArg): Promise<Response> {
if (path !== '' || !resource.startsWith('ipns://')) {
return badRequestResponse('Invalid IPNS name')
return badRequestResponse(resource, 'Invalid IPNS name')
}

let peerId: PeerId

try {
peerId = peerIdFromString(resource.replace('ipns://', ''))
} catch (err) {
} catch (err: any) {
this.log.error('could not parse peer id from IPNS url %s', resource)

return badRequestResponse('Invalid IPNS name')
return badRequestResponse(resource, err)
}

// since this call happens after parseResource, we've already resolved the
Expand Down

0 comments on commit cc228e6

Please sign in to comment.