{"id":16326687,"url":"https://github.com/chrisyip/koa-buddy","last_synced_at":"2025-10-25T20:32:06.719Z","repository":{"id":18138870,"uuid":"21225867","full_name":"chrisyip/koa-buddy","owner":"chrisyip","description":"Request body parser for Koa","archived":false,"fork":false,"pushed_at":"2014-09-18T10:22:45.000Z","size":160,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-31T10:26:05.651Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/chrisyip.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-26T02:48:42.000Z","updated_at":"2016-04-12T23:52:46.000Z","dependencies_parsed_at":"2022-09-24T05:00:21.013Z","dependency_job_id":null,"html_url":"https://github.com/chrisyip/koa-buddy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisyip%2Fkoa-buddy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisyip%2Fkoa-buddy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisyip%2Fkoa-buddy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisyip%2Fkoa-buddy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrisyip","download_url":"https://codeload.github.com/chrisyip/koa-buddy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238207648,"owners_count":19434095,"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":[],"created_at":"2024-10-10T23:09:17.769Z","updated_at":"2025-10-25T20:32:06.370Z","avatar_url":"https://github.com/chrisyip.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# koa-buddy\n\n[![Node version][node-image]][npm-url] [![NPM version][npm-image]][npm-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Travis CI][travis-image]][travis-url]\n\nRequest body parser for Koa\n\n# Usage\n\n```bash\nnpm install --save koa-buddy\n```\n\n```js\nconst app = require('koa')()\n    , buddy = require('koa-buddy')\n    , router = require('koa-router')\n\napp.use(buddy())\n\napp.use(router(app))\n\n/* posting application/json to /users\n{\n  \"name\": \"John Doe\"\n}\n*/\napp.post('/users', function* (next) {\n  console.log(this.request.body) // object { \"name\": \"John Doe\" }\n  yield next\n})\n\n/* posting application/xml to /books\n\u003c?xml version=\"1.0\"?\u003e\n\u003ccatalog\u003e\n   \u003cbook id=\"bk101\"\u003e\n      \u003cauthor\u003eGambardella, Matthew\u003c/author\u003e\n      \u003ctitle\u003eXML Developer's Guide\u003c/title\u003e\n      \u003cgenre\u003eComputer\u003c/genre\u003e\n      \u003cprice\u003e44.95\u003c/price\u003e\n      \u003cpublish_date\u003e2000-10-01\u003c/publish_date\u003e\n      \u003cdescription\u003eAn in-depth look at creating applications\n      with XML.\u003c/description\u003e\n   \u003c/book\u003e\n\u003c/catalog\u003e\n*/\napp.post('/books', function* (next) {\n  console.log(this.request.body)\n  /* object:\n  { declaration: { attributes: { version: '1.0' } },\n    root:\n     { name: 'catalog',\n       attributes: {},\n       children: [ [Object] ],\n       content: '' } }\n  */\n  yield next\n})\n\n```\n\nSupported methods: `PATCH`, `POST`, `PUT`, and `TRACE`.\n\nSupported `Content-Type`:\n\n- `application/xml`\n- `application/json`\n- `application/x-www-form-urlencoded`\n- `text/*` *(treated as **plain text**)*\n- `multipart` *(untested)*\n\nIf `Content-Type` is not supported, `koa-buddy` passes request stream buffer to `this.request.body`.\n\n# Todo\n\n- examples\n- tests\n\n# Contributors\n\n- [Chris Yip](http://github.com/chrisyip/koa-buddy/commits/master?author=chrisyip)\n\n[node-image]: http://img.shields.io/node/v/koa-buddy.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/koa-buddy\n[npm-image]: http://img.shields.io/npm/v/koa-buddy.svg?style=flat-square\n[daviddm-url]: https://david-dm.org/chrisyip/koa-buddy\n[daviddm-image]: http://img.shields.io/david/chrisyip/koa-buddy.svg?style=flat-square\n[travis-url]: https://travis-ci.org/chrisyip/koa-buddy\n[travis-image]: http://img.shields.io/travis/chrisyip/koa-buddy.svg?style=flat-square\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisyip%2Fkoa-buddy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrisyip%2Fkoa-buddy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisyip%2Fkoa-buddy/lists"}