Skip to content

Commit a850e3e

Browse files
beaulacdmitrizagidulin
authored andcommitted
handle JSON response outside http-client
1 parent 6be54f0 commit a850e3e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/documentLoader.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const httpClientHandler = {
5454
'Cache-Control': 'no-cache',
5555
'Pragma': 'no-cache'
5656
};
57-
result = await httpClient.get(params.url, { headers });
57+
result = await httpClient.get(params.url, { headers, parseBody: false });
5858
} catch(e: any) {
5959
throw new Error(`NotFoundError loading "${params.url}": ${e.message}`);
6060
}

test/documentLoader.spec.ts

+8
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ describe('documentLoader', () => {
2424
.equal('did:key:z6MkhVTX9BF3NGYX6cc7jWpbNnR7cAjH8LUffabZP8Qu4ysC');
2525
});
2626

27+
it('should load v2 context from web', async () => {
28+
const documentLoader = securityLoader({fetchRemoteContexts: true}).build();
29+
30+
const url = 'https://www.w3.org/ns/credentials/v2';
31+
const result = await documentLoader(url);
32+
expect(result.document).to.exist;
33+
});
34+
2735
it('supports beta OBv3 context', async () => {
2836
const load = securityLoader().build()
2937
const { document } = await load('https://purl.imsglobal.org/spec/ob/v3p0/context.json')

0 commit comments

Comments
 (0)