Skip to content

Commit e3dae15

Browse files
committed
#47 Updated readme.
1 parent 1d61c2d commit e3dae15

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

Readme.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,20 @@ form.append('my_buffer', new Buffer(10));
5555
form.append('my_logo', request('http://nodejs.org/images/logo.png'));
5656
```
5757

58-
In order to submit this form to a web application, you can use node's http
59-
client interface:
58+
In order to submit this form to a web application, call ```submit(url, [callback])``` method:
59+
60+
``` javascript
61+
form.submit('http://example.org/', function(err, res) {
62+
// res – response object (http.IncomingMessage)
63+
});
64+
65+
```
66+
67+
For more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods.
68+
69+
### Alternative submission methods
70+
71+
You can use node's http client interface:
6072

6173
``` javascript
6274
var http = require('http');
@@ -102,7 +114,7 @@ form.submit('http://example.com/', function(err, res) {
102114
});
103115
```
104116

105-
Form-Data can recognize and fetch all the required information from common types of streams (fs.readStream, http.response and mikeal's request), for some other types of streams you'd need to provide "file"-related information manually:
117+
Form-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide "file"-related information manually:
106118

107119
``` javascript
108120
someModule.stream(function(err, stdout, stderr) {

0 commit comments

Comments
 (0)