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

HTTP POST with form fields not working #86

Open
Doogiemuc opened this issue Apr 29, 2016 · 6 comments
Open

HTTP POST with form fields not working #86

Doogiemuc opened this issue Apr 29, 2016 · 6 comments

Comments

@Doogiemuc
Copy link

see http://stackoverflow.com/a/36938187/6113110

It seems that simply the chai-http documentation is wrong. It sais:

// Send some Form Data
chai.request(app)
 .post('/user/me')
 .field('_method', 'put')
 .field('password', '123')
 .field('confirmPassword', '123')

Which does NOT work. This worked for me:

chai.request(app)
  .post('/create')
  .send({ 
      title: 'Dummy title',
      description: 'Dummy description'
  })
  .end(function(err, res) { ... }
@ghost
Copy link

ghost commented May 16, 2016

I can confirm. I tried everything, but could not make .field() work. I could post data only with .send().

@keithamus
Copy link
Member

Hey @Doogiemuc thanks for the issue. Thanks @C00bra for confirming

Do either of you have the time to work on a PR fixing the documentation? Contributors get a permanent place in our hall of fame.

@dman777
Copy link

dman777 commented May 8, 2017

I hit this issue also. I don't believe the documentation/README is updated with use send({ obj: property}) instead of .field() for POST.

@keithamus should there even be a .field() method for PUT on forms? I don't believe HTML forms support PUT.

@wzup
Copy link

wzup commented Jun 20, 2017

Same issue here #165
Thanks a lot for not documenting it. I wasted 1 hour to understand that plugin's README is just a fantasy that has nothing to do with reality

.send() by the way doesn't work either

@meeber
Copy link
Contributor

meeber commented Jun 20, 2017

@wzup As mentioned in the other thread, please check out #97 (comment); I think it may relate to the issue you're running into.

I get that you're frustrated but please understand that this is a 100% community-driven project that relies on people like yourself discovering issues or things that frustrate them and then submitting a PR to fix them so that future people don't run into the same issue. The original creator of this plugin hasn't been around since like 2013. I've never used this plugin myself but check in from time-to-time to help troubleshoot an issue or review a PR.

@coinop-logan
Copy link

This actually does seem to be supported now. I came across this thread googling some other issue - I'm able to use the .field() method just fine. Maybe this issue can be closed?

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

No branches or pull requests

6 participants