Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting parse error #15

Open
ralyodio opened this issue May 21, 2015 · 3 comments
Open

getting parse error #15

ralyodio opened this issue May 21, 2015 · 3 comments
Assignees
Labels

Comments

@ralyodio
Copy link

function* create(next) {
    try{
        // Parse the POST data
        var todo = yield parse(this); //this throws an error

https://github.com/rethinkdb/rethinkdb-example-nodejs/blob/master/todo-angular-koa/app.js#L64
This example throws an error for me.

screenshot 2015-05-21 03 29 55

I tried yield parse.json(this) and still not sure what the deal is. Same message.

Typically this means its not an object...but a string, and it indeed looks like JSON.stringify was ran on it.

@deontologician deontologician self-assigned this May 21, 2015
@deontologician
Copy link
Contributor

Hi @chovy. It looks like it's trying to parse a javascript object literal as json, and failing because the key isn't double quoted. I'll have to dig into this repo to fix it, which may take a while to get to.

In the meantime, if you happen to find the root cause and hack around it, I'd welcome any pull requests.

@ralyodio
Copy link
Author

I'll see if I can find the root cause in the meantime.

@ralyodio
Copy link
Author

Looks like co-body is for co not koa.

Reccommended use is to use koa-bodyparser: https://github.com/koajs/bodyparser

I will see if I can get it working tonight and let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants