How to use the @decentralized-identity/sidetree.SidetreeResponse.toHttpStatus function in @decentralized-identity/sidetree

To help you get started, we’ve selected a few @decentralized-identity/sidetree examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github decentralized-identity / ion / src / core.ts View on Github external
const setKoaResponse = (response: SidetreeResponseModel, koaResponse: Koa.Response) => {
  koaResponse.status = SidetreeResponse.toHttpStatus(response.status);

  if (response.body) {
    koaResponse.set('Content-Type', 'application/json');
    koaResponse.body = response.body;
  } else {
    // Need to set the body explicitly to empty string, else koa will echo the request as the response.
    koaResponse.body = '';
  }
};
github decentralized-identity / ion / src / ipfs.ts View on Github external
const setKoaResponse = (response: SidetreeResponseModel, koaResponse: Koa.Response, contentType?: string) => {
  koaResponse.status = SidetreeResponse.toHttpStatus(response.status);
  if (contentType) {
    koaResponse.set('Content-Type', contentType);
  } else {
    koaResponse.set('Content-Type', 'application/json');
  }

  if (response.body) {
    koaResponse.body = response.body;
  } else {
    // Need to set the body explicitly, otherwise Koa will return HTTP 204.
    koaResponse.body = '';
  }
};

@decentralized-identity/sidetree

Node.js implementation of Sidetree.

Apache-2.0
Latest version published 2 years ago

Package Health Score

48 / 100
Full package analysis

Similar packages