Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,17 @@ router.get(`${resolvePath}:did`, async (ctx, _next) => {
// Strip away the first '/identifiers/' string.
const didOrDidDocument = ctx.url.split(resolvePath)[1];
const response = await sidetreeCore.handleResolveRequest(didOrDidDocument);
setKoaResponse(response, ctx.response);
const koaResponse = ctx.response;
koaResponse.status = SidetreeResponse.toHttpStatus(response.status);

if (!response.body) {
koaResponse.body = '';
} else {
koaResponse.set('Content-Type', 'application/ld+json;profile="https://w3id.org/did-resolution";charset=utf-8');
// Stringify the result as otherwise the Content-Type gets overridden to

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if you reverse line 78 and 81? If works, it would be nicer to refactor setKoaResponse() to take in optional headers to set.

// application/json.
koaResponse.body = JSON.stringify(response.body);
}
});

router.get('/monitor/operation-queue-size', async (ctx, _next) => {
Expand Down