Skip to content

Set DID Resolution Result media type#244

Open
clehner wants to merge 1 commit intodecentralized-identity:masterfrom
spruceid:fix/did-resolution-type
Open

Set DID Resolution Result media type#244
clehner wants to merge 1 commit intodecentralized-identity:masterfrom
spruceid:fix/did-resolution-type

Conversation

@clehner
Copy link
Copy Markdown

@clehner clehner commented Jan 6, 2022

Set the Content-Type header of the DID Resolution Result HTTP response to use the media type with profile parameter specified for a DID Resolution Result in DID Resolution: application/ld+json;profile="https://w3id.org/did-resolution".

Setting this Content-Type header helps DID resolver HTTP clients detect that the response is a DID Resolution Result - rather than e.g. a DID document alone, which is also allowed by DID Resolution's HTTP(S) Binding.

Comment thread src/core.ts
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.

Copy link
Copy Markdown
Collaborator

@thehenrytsai thehenrytsai left a comment

Choose a reason for hiding this comment

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

Commented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants