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
// Note that node-fetch@2 performs more strictness tests for Blob objects, so you may need to do extra steps before you set up request body (like, maybe you'll need to instaniate a Blob with BlobDataItem as one of its blobPart)
148
+
constblob=newBlobDataItem(enocoder) // or new Blob([new BlobDataItem(enocoder)], {type: encoder.contentType})
149
+
150
+
constoptions= {
151
+
method:"post",
152
+
body: blob
153
+
}
154
+
155
+
awaitfetch("https://httpbin.org/post", options)
156
+
```
157
+
158
+
5. In this example we will pull FormData content into the ReadableStream:
105
159
106
160
```js
107
161
// This module is only necessary when you targeting Node.js or need web streams that implement Symbol.asyncIterator
@@ -140,7 +194,7 @@ const options = {
140
194
awaitfetch("https://httpbin.org/post", options)
141
195
```
142
196
143
-
5. Speaking of async iterables - if HTTP client supports them, you can use encoder like this:
197
+
6. Speaking of async iterables - if HTTP client supports them, you can use encoder like this:
144
198
145
199
```js
146
200
import {Encoder} from"form-data-encoder"
@@ -163,7 +217,7 @@ const options = {
163
217
awaitfetch("https://httpbin.org/post", options)
164
218
```
165
219
166
-
6. ...And for those client whose supporting form-data-encoder out of the box, the usage will be much, much more simpler:
220
+
7. ...And for those client whose supporting form-data-encoder out of the box, the usage will be much, much more simpler:
167
221
168
222
```js
169
223
import {FormData} from"formdata-node"// Or any other spec-compatible implementation
0 commit comments