1.0.1 • Published 2 years ago

@kauai/body v1.0.1

Weekly downloads
-
License
AGPL-3.0-only
Repository
github
Last release
2 years ago

@kauai/body CI Status version Known Vulnerabilities Coverage Status code style: prettier semantic-release Conventional Commits GitHub top language node version npm downloads License

Kauai body parser middleware. Supports the following content types

  • application/json
  • application/x-www-form-urlencoded
  • plain/text

and any combination of the following encodings

  • br
  • x-gzip
  • gzip
  • deflate

Installation

npm install @kauai/body

Usage

import BodyParser from "@kauai/body";

class MyMiddleware extends Middleware {
  public run(context: Context): void {
    const { body } = context.request;
    context.log.info("Body has been parsed (or not)", { body });
  }
}

app.use("/deposit", new Router().post(new BodyParser(), new MyMiddleware()));

Test

npm run test:ci