Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FormData example #203

Closed
na-- opened this issue Jan 27, 2021 · 2 comments · Fixed by #206
Closed

Add FormData example #203

na-- opened this issue Jan 27, 2021 · 2 comments · Fixed by #206
Assignees
Labels
Area: OSS Content Improvements or additions to community/oss documentation Priority: High

Comments

@na--
Copy link
Member

na-- commented Jan 27, 2021

After grafana/k6#1800 and grafana/jslib.k6.io#21 are merged (i.e. k6 v0.31.0), we should add an example that demonstrates how to build advanced multipart/form-data request bodies with them. As evidenced by grafana/k6#747, grafana/k6#843, grafana/k6#1375, grafana/k6#1382, grafana/k6#1571, grafana/k6#1784, the current k6 HTTP API is quite restricted and can't cover a lot of corner cases... 😞 We'll close these issues (grafana/k6#1800 (comment)), so we probably should also add warning messages in https://k6.io/docs/javascript-api/k6-http/file-data-filename-contenttype and https://k6.io/docs/javascript-api/k6-http/filedata to use the JS polyfill for the corner cases the Go API can't cover.

At some future point, we'll try to fix all of these deficiencies with a new and better k6 JS API for HTTP requests, but until then this polyfill will likely be sufficient for 99% of users, with almost no downsides. So, we should document it properly.

@na-- na-- added Area: OSS Content Improvements or additions to community/oss documentation Priority: High Status: Available labels Jan 27, 2021
@imiric
Copy link
Contributor

imiric commented Jan 27, 2021

👍 I was planning to pick this up starting today. Too soon?

The polyfill works even without #1800, since it only needs ArrayBuffer support in request bodies, which is in v0.30.0. So the docs for this could be released whenever the jslib PR is released (this/next week?).

@imiric imiric self-assigned this Jan 27, 2021
@na--
Copy link
Member Author

na-- commented Jan 27, 2021

Yeah, I didn't realize it, but that's awesome! Maybe some of the issues above wouldn't be closed until we release k6 v0.31.0, but most should be fine with what we have in k6 v0.30.0. I'll make sure to review grafana/jslib.k6.io#21 tomorrow then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: OSS Content Improvements or additions to community/oss documentation Priority: High
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants