{"id":18910111,"url":"https://github.com/cretezy/deno_body_parser","last_synced_at":"2026-05-01T04:35:19.451Z","repository":{"id":62420915,"uuid":"281560499","full_name":"Cretezy/deno_body_parser","owner":"Cretezy","description":"A generic HTTP body parser for Deno","archived":false,"fork":false,"pushed_at":"2020-07-22T22:43:00.000Z","size":13,"stargazers_count":3,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T02:35:27.318Z","etag":null,"topics":["body-parser","deno"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cretezy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null},"funding":{"github":"Cretezy"}},"created_at":"2020-07-22T03:04:23.000Z","updated_at":"2022-02-06T17:58:39.000Z","dependencies_parsed_at":"2022-11-01T17:30:44.755Z","dependency_job_id":null,"html_url":"https://github.com/Cretezy/deno_body_parser","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cretezy%2Fdeno_body_parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cretezy%2Fdeno_body_parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cretezy%2Fdeno_body_parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cretezy%2Fdeno_body_parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cretezy","download_url":"https://codeload.github.com/Cretezy/deno_body_parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239899084,"owners_count":19715335,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["body-parser","deno"],"created_at":"2024-11-08T09:41:12.293Z","updated_at":"2026-03-07T23:30:17.784Z","avatar_url":"https://github.com/Cretezy.png","language":"TypeScript","funding_links":["https://github.com/sponsors/Cretezy"],"categories":[],"sub_categories":[],"readme":"# Deno Body Parser\n\nGeneric body parser for Deno's `ServerRequest` body.\n\n**Features**:\n\n- Multiple input types: JSON, URL encoded\n- Custom Content-Type checks (strings/RegExps/functions)\n- Limit checks\n- Generalized (can be used with/by any framework) and well tested\n\n## Example\n\n```ts\nimport { createBodyParser, JsonBodyParser } from \"https://deno.land/x/body_parser/mod.ts\";\n\nconst bodyParser = createBodyParser({\n  parsers: [new JsonBodyParser()],\n});\n\n// ...\n\n// Request with Content-Type of application/json with {\"x\": 1}\n\nconst results = await bodyParser(req);\n\nassertEquals(results, {\n  parser: \"json\",\n  value: {\n    x: 1,\n  },\n});\n```\n\n[View full example](./example.ts)\n\n## Usage\n\n### `createBodyParser`\n\nCreates the body parser using a list a parsers as an option.\nThe created body parser accepts a `ServerRequest` from Deno's HTTP server, and returns `undefined`\nif no suitable parser is found (based on `Content-Type`), or an object of `{ parser: string, value: any}`\nif one was found.\n\nAll parsers accept the follow options:\n\n- `limit`: The limit in bytes of body to parser\n- `type`: One of many strings, RegExps, of functions to check if the `Content-Type` is suitable for the parser\n\n### Built-in parsers\n\n#### `JsonBodyParser` (`json`)\n\nA parser for JSON requests using `application/json`.\n\nAccepts the follow options (includiong the default ones listed above):\n\n- `strict`: If enabled, only objects/arrays will be allowed to be parsed. Defaults to `false\n- `reviver`: The second argument to `JSON.parse`. You shouldn't need this. [Read more about revivers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)\n\n#### `UrlencodedBodyParser` (`urlencoded`)\n\nA parser for form requests using `application/x-www-form-urlencoded`.\n\n### Custom parsers\n\nYou can implement your own parsers by extending `BodyParser`. You can see examples for the [JSON parser](./src/jsonParser.ts) or [URL encoded parser](./src/urlencodedParser.ts).\n\n## Support\n\nSince Deno is evolving quickly, only the latest version is officially supported.\n\nPlease file feature requests and bugs at the [issue tracker](https://github.com/Cretezy/deno_body_parser/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcretezy%2Fdeno_body_parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcretezy%2Fdeno_body_parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcretezy%2Fdeno_body_parser/lists"}