You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-18Lines changed: 30 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -295,25 +295,37 @@ See the [form-data README](https://github.com/felixge/node-form-data) for more i
295
295
Some variations in different HTTP implementations require a newline/CRLF before, after, or both before and after the boundary of a `multipart/related` request (using the multipart option). This has been observed in the .NET WebAPI version 4.0. You can turn on a boundary preambleCRLF or postamble by passing them as `true` to your request options.
console.log('Upload successful! Server responded with:', body);
322
+
},
323
+
function (error, response, body) {
324
+
if (error) {
325
+
returnconsole.error('upload failed:', error);
315
326
}
316
-
)
327
+
console.log('Upload successful! Server responded with:', body);
328
+
})
317
329
```
318
330
319
331
@@ -514,10 +526,10 @@ The first argument can be either a `url` or an `options` object. The only requir
514
526
* `body` - entity body for PATCH, POST and PUT requests. Must be a `Buffer` or `String`, unless `json` is `true`. If `json` is `true`, then `body` must be a JSON-serializable object.
515
527
* `form` - when passed an object or a querystring, this sets `body` to a querystring representation of value, and adds `Content-type: application/x-www-form-urlencoded` header. When passed no options, a `FormData` instance is returned (and is piped to request). See "Forms" section above.
516
528
* `formData` - Data to pass for a `multipart/form-data` request. See "Forms" section above.
517
-
* `multipart` - (experimental) Data to pass for a `multipart/related` request. See "Forms" section above
529
+
* `multipart` - array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See _Forms_ section above.
530
+
* Alternatively you can pass in an object `{chunked:false, data: []}` where `chunked` is used to specify the `transfer-encoding` header of your request. In non chunked requests body streams are not allowed.
518
531
* `auth` - A hash containing values `user` || `username`, `pass` || `password`, and `sendImmediately` (optional). See documentation above.
519
532
* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as JSON.
520
-
* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below.
521
533
* `preambleCRLF` - append a newline/CRLF before the boundary of your `multipart/form-data` request.
522
534
* `postambleCRLF` - append a newline/CRLF at the end of the boundary of your `multipart/form-data` request.
523
535
* `followRedirect` - follow HTTP 3xx responses as redirects (default: `true`). This property can also be implemented as function which gets `response` object as a single argument and should return `true` if redirects should continue or `false` otherwise.
0 commit comments