Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enable setting headers to DAF DID Comm #239

Merged
merged 2 commits into from
Nov 12, 2020
Merged
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
4 changes: 3 additions & 1 deletion packages/daf-did-comm/src/action-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface ActionSendDIDComm extends Action {
type: string
body: any
}
headers?: Record<string, string>
}

export class DIDCommActionHandler extends AbstractActionHandler {
Expand All @@ -28,7 +29,7 @@ export class DIDCommActionHandler extends AbstractActionHandler {

public async handleAction(action: Action, agent: Agent) {
if (action.type === ActionTypes.sendMessageDIDCommAlpha1) {
const { data, url, save = true } = action as ActionSendDIDComm
const { data, url, headers, save = true } = action as ActionSendDIDComm

debug('Resolving didDoc')
const didDoc = await agent.didResolver.resolve(data.to)
Expand Down Expand Up @@ -66,6 +67,7 @@ export class DIDCommActionHandler extends AbstractActionHandler {
const res = await fetch(serviceEndpoint, {
method: 'POST',
body: postPayload,
headers,
})
debug('Status', res.status, res.statusText)

Expand Down