Skip to content

Commit cdac8d4

Browse files
author
Ivan Mirić
authored
Add plain text field example to FormData docs (#236)
Closes #225
1 parent d5f5cc5 commit cdac8d4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/data/markdown/docs/05 Examples/01 Examples/09 data-uploads.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ The previous multipart request example has some limitations:
9898
- It's not possible to upload multiple files as part of the same form field, because
9999
JS object keys must be unique.
100100

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).
102102

103103
Here's an example of uploading several binary files and a text file using the polyfill:
104104

@@ -107,14 +107,16 @@ Here's an example of uploading several binary files and a text file using the po
107107
```javascript
108108
import http from 'k6/http';
109109
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';
111111

112112
const img1 = open('/path/to/image1.png', 'b');
113113
const img2 = open('/path/to/image2.jpg', 'b');
114114
const txt = open('/path/to/text.txt');
115115

116116
export default function() {
117117
const fd = new FormData();
118+
fd.append('someTextField', 'someValue');
119+
fd.append('anotherTextField', 'anotherValue');
118120
fd.append('images', http.file(img1, 'image1.png', 'image/png'));
119121
fd.append('images', http.file(img2, 'image2.jpg', 'image/jpeg'));
120122
fd.append('text', http.file(txt, 'text.txt', 'text/plain'));

0 commit comments

Comments
 (0)