Skip to content

Commit

Permalink
fix(did-resolver): send Accept header to universal resolver. (#1203)
Browse files Browse the repository at this point in the history
Use `Accept: application/ld+json;profile="https://w3id.org/did-resolution"` to ensure the response is a DID resolution and not a DID document.
  • Loading branch information
jasny authored Jul 24, 2023
1 parent 70d49f4 commit c86d918
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/did-resolver/src/universal-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ export function getUniversalResolver(

const resolve: DIDResolver = async (didUrl: string): Promise<DIDResolutionResult> => {
try {
const result = await fetch(url + didUrl)
const headers = { 'Accept': 'application/ld+json;profile="https://w3id.org/did-resolution"' }
const result = await fetch(url + didUrl, { headers })

Check warning on line 47 in packages/did-resolver/src/universal-resolver.ts

View check run for this annotation

Codecov / codecov/patch

packages/did-resolver/src/universal-resolver.ts#L46-L47

Added lines #L46 - L47 were not covered by tests
const ddo = await result.json()
return ddo
} catch (e) {
Expand Down

0 comments on commit c86d918

Please sign in to comment.