-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Can't encode a multipart part without a filename #1784
Comments
Hi @HoneyryderChuck, The current way the whole multipart body generation works has a lot of ... problems(#747 #1382 #1571) among ... others. The current plan fixed for this is to discourage the actual usage of the k6 in a method in favor of using a FormData polyfill (maybe specifically written for k6) after the merging of #1776. It is actually a thing that I plan on actually testing and getting ready, but haven't gotten to. There are also plans for a new HTTP API, because of the problems above and .. others. But that maybe will just include some internal FormData, maybe not 🤷♂️ |
I'm not entirely familiar with how the FormData polyfill would turn out in the end, and what are the plans for a new API. However, I think that a "quickfix" for this, at least until all this evolves, is for the |
There are 2 problems:
So, no, we are unlikely to make a quick fix :) You can of course make one yourself and compile k6 with it and use it. Although I will argue that if you can do that, you can build from the PR I linked above and use the polyfill as is and it will likely work better and will be compatible with the future k6 ;) |
This comment has been minimized.
This comment has been minimized.
I will bump this issue. I was trying to send a json data and a file in a mulitpart request, which I could not using k6. The openapi looks like below: openapi: 3.0.3
info:
version: "1"
title: Multiple Content Types for same request
paths:
/multiplecontentpath:
post:
requestBody:
content:
mutlipart/form-data:
schema:
type: object
properties:
coordinates:
$ref: '#/components/schemas/coordinates'
file:
type: string
format: binary
responses:
201:
description: Successfully created
headers:
Location:
schema:
type: string
components:
schemas:
coordinates:
type: object
required:
- lat
- long
properties:
lat:
type: number
long:
type: number How are things regarding multipart/form-data ? |
Hey @mirzaprangon, Did you try the FormData polyfill, it should cover this case. Just make sure to follow what is suggested here: grafana/k6-jslib-formdata#4 (comment). In the future, we plan to have native support for FormData web API in k6. Unfortunately, this is not yet on our short-term roadmap. Let me know if it helps. |
Using the JS layer to do a multipart request isn't so straightforward if uploading complex parts other than files.
There should therefore be a new method, ex.
http.part
or something, where the filename is omitted.The text was updated successfully, but these errors were encountered: