@@ -98,7 +98,7 @@ The previous multipart request example has some limitations:
98
98
- It's not possible to upload multiple files as part of the same form field, because
99
99
JS object keys must be unique.
100
100
101
- To address this we suggest using the [ ` FormData ` polyfill for k6] ( https://jslib.k6.io/formdata/0.0.1 /index.js ) .
101
+ To address this we suggest using the [ ` FormData ` polyfill for k6] ( https://jslib.k6.io/formdata/0.0.2 /index.js ) .
102
102
103
103
Here's an example of uploading several binary files and a text file using the polyfill:
104
104
@@ -107,14 +107,16 @@ Here's an example of uploading several binary files and a text file using the po
107
107
``` javascript
108
108
import http from ' k6/http' ;
109
109
import { check } from ' k6' ;
110
- import { FormData } from ' https://jslib.k6.io/formdata/0.0.1 /index.js' ;
110
+ import { FormData } from ' https://jslib.k6.io/formdata/0.0.2 /index.js' ;
111
111
112
112
const img1 = open (' /path/to/image1.png' , ' b' );
113
113
const img2 = open (' /path/to/image2.jpg' , ' b' );
114
114
const txt = open (' /path/to/text.txt' );
115
115
116
116
export default function () {
117
117
const fd = new FormData ();
118
+ fd .append (' someTextField' , ' someValue' );
119
+ fd .append (' anotherTextField' , ' anotherValue' );
118
120
fd .append (' images' , http .file (img1, ' image1.png' , ' image/png' ));
119
121
fd .append (' images' , http .file (img2, ' image2.jpg' , ' image/jpeg' ));
120
122
fd .append (' text' , http .file (txt, ' text.txt' , ' text/plain' ));
0 commit comments