Skip to content

Commit c4067f8

Browse files
authored
Update request.js documentation
This clarifies how to send form data. `.field()` works for multi-part forms, but according to the [SuperAgent documentation](https://visionmedia.github.io/superagent/#post-/-put-requests) `.send()` should be used to send the post data as `application/x-www-form-urlencoded`. This addresses issue #86. There is an older pull request by @BenAychh, but it modified the README.md file directly. According to the discussion, the README.md file is generated based on request.js, and so the documentation should be modified here.
1 parent 3ea4524 commit c4067f8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/request.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,10 @@ var http = require('http')
6868
* // Send some Form Data
6969
* chai.request(app)
7070
* .post('/user/me')
71-
* .field('_method', 'put')
72-
* .field('password', '123')
73-
* .field('confirmPassword', '123')
71+
* .type('form')
72+
* .send({'_method': 'put'})
73+
* .send({'password': '123'})
74+
* .send({'confirmPassword', '123'})
7475
* ```
7576
*
7677
* ```js

0 commit comments

Comments
 (0)