cojs / co-body

Parse request bodies with co
MIT License
325 stars 42 forks source link

Missing content-type #19

Closed Globegitter closed 9 years ago

Globegitter commented 9 years ago

If I just try the most basic example

var koa = require('koa');
var app = koa();
var parse = require('co-body');

app.use(function *(){
   this.body = yield parse(this);
});

app.listen(3000);

When I am then visiting localhost:3000 I am getting the error Unsupported Media Type. All I am trying to achieve right now is pars simple query parameters, such as localhost:3000?q=1.

Edit: Ahhh for this I don't need to parse it seems. So this is just for parsing post bodys then?

yoshuawuyts commented 9 years ago

yup, co-body is just for parsing the body. this.request.query || this.request.querystring is probably what you're looking for -- https://github.com/koajs/koa/blob/master/lib/request.js

Globegitter commented 9 years ago

Thank you for the clarification :)