cojs / co-body

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

Switch to promises ? #29

Closed jltrv closed 9 years ago

jltrv commented 9 years ago

Hello, since thunks are deprecated in favor of promises in co, maybe co-body should switch to promises. I'm willing to work on a pull request if there is any interest. Just tell me.

haoxins commented 9 years ago

I'm +1 for Promise, but maybe @fengmk2 thinks thunk work fine now.

jltrv commented 9 years ago

I went ahead and created pull request #30.

yoshuawuyts commented 9 years ago

This would be very nice to have, especially since async await doesn't seem to play ball with the current implementation.

e.g. this doesn't work yet:

async function (req, res) {
  const body = await parse.json(req)
}

But from my understanding it will work if it was promise based.

fengmk2 commented 9 years ago

+1

jltrv commented 9 years ago

Included in 4.0 :smile_cat: