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

Not possible to post with body using VanillaGateWay #31

Closed
klippx opened this issue Jun 15, 2016 · 1 comment
Closed

Not possible to post with body using VanillaGateWay #31

klippx opened this issue Jun 15, 2016 · 1 comment
Labels

Comments

@klippx
Copy link
Collaborator

klippx commented Jun 15, 2016

Reproduce:

https://github.com/klippx/roger/tree/mappersmith-issue

This commit breaks the express middleware: klippx/roger@79d54e3

If I start the app and post the form using commit klippx/roger@9acdf0a I get this output in backend:

App running at http://localhost:3100/
GET /links.json {}
fetching {links} from graphql
--bodyParser: URLENCODED--, encoding: utf-8
POST /links/create.json { title: '123', url: 'abc' }

 == create-link handler ==
body: { title: '123', url: 'avc' }

But without jquery/jquery gateway I get this:

App running at http://localhost:3100/
GET /links.json {}
fetching {links} from graphql
POST /links/create.json {}

 == create-link handler ==
body: {}
creating new {link} in graphql
    mutation {
      add(title: undefined, url: undefined) {
        id, title, url
      }
    }

As you can see above, it totally skipped the express bodyParser middleware.

Curl is always possible regardless of commit sha:

curl -H "Content-Type: application/json" -X POST -d '{"title":"xyz","url":"http://123"}' http://localhost:3100/data/links/create.json
@tulios tulios added the Bug label Jun 15, 2016
@tulios
Copy link
Owner

tulios commented Jun 17, 2016

Thanks! As stated here application/x-www-form-urlencoded doesn't have charset defined in the header, I was able to replicate the problem with curl:

curl -v \
  -XPOST \
  -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8;' \
  -d "title=test1&url=test2" \
  http://localhost:3100/data/links/create.json

Removing charset=utf-8 fixes the problem. A bugfix version is on its way!

@tulios tulios closed this as completed in 4ae468a Jun 17, 2016
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