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

The "path" argument must be of type string. Received an instance of Array ( ERROR if src is array for files form-data) #28

Closed
Barolina opened this issue Dec 7, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@Barolina
Copy link

Barolina commented Dec 7, 2021

I run

postman-to-k6 tr.json -o k6.js -e tr_env.json

than get this result )

The "path" argument must be of type string. Received an instance of Array

I don't now, why?))

My collection is example

									],
							"request": {
								"method": "POST",
								"header": [
									{
											"key": "Content-Type",
												"value": "multipart/mixed",
												"type": "text",
												"disabled": true
									}
								],
								"body": {
										"mode": "formdata",
											"formdata": [
												{
													"key": "files[]",
													"description": "Массив файлов",
													"type": "file",
													"src": [
														"1.txt",
														"2.txt"
													]
												},
												{
													"key": "data",
													"value": "{\n\t\"name\": \"{{name}}\",\n\t\"num\": \"{{num}}\",\n\t\"reg_date\": \"{{reg_date}}\",\n\t\"source_id\": \"{{source_id}}\",\n\t\t\t\t\t\t\t\t\t \n\t\"attr\": [{\n\t\t\t\t  \n\t\t\t\"attr_id\": {{attr1_id}},\n\t\t\t\"attr_value\": {{rand_num}}\n\t\t},\n\t\t{\n\t\t\t\t  \n\t\t\t\"attr_id\": {{attr2_id}},\n\t\t\t\"attr_value\": \"{{rand_str}}\"\n\t\t},\n\t\t{\n\t\t\t\t  \n\t\t\t\"attr_id\": {{attr3_id}},\n\t\t\t\"attr_value\": \"{{rand_date}}\"\n\t\t},\n\t\t{\n\t\t\t\t  \n\t\t\t\"attr_id\": {{attr4_id}},\n\t\t\t\"attr_value\": {{rand_bool}}\n\t\t},\n\t\t{\n\t\t\t\t \n\t\t\t\"attr_id\": {{attr5_id}}\n\t\t}\n\t],\n\t\"files\": [{\n\t\t\"file\": \"1.txt\",\n\t\t\"fr_id\": {{fr_id1}},\n\t\t\"parent_file\": null\n\t}, {\n\t\t\"file\": \"2.txt\",\n\t\t\"fr_id\": {{fr_id2}},\n\t\t\"parent_file\": \"1.txt\"\n\t}]\n}",
													"contentType": "application/json",
													"description": "JSON",
													"type": "text"
												}
											]
						
								},
								"url": {
									"raw": "https://trarchive.it-thematic.ru/api/ead/eds/",

But i use to POST form-date like multi-form (multipart/mixed) and body like 'raw', maybe this problem?)

yes, he is doesn't path to file

	"1.txt",
	"2.txt"
]

@thim81 thim81 added the bug Something isn't working label Dec 7, 2021
@SanthoshRaju91
Copy link

SanthoshRaju91 commented Jul 26, 2022

I got the same issue. @Barolina were you able to figure out the issue ?

@SanthoshRaju91
Copy link

I found the issue is due to the below property's value type in form data. I'm guessing the library does not support list files in request body.

"src": [
  "1.txt",
  "2.txt"
]

@Barolina
Copy link
Author

Barolina commented Aug 9, 2022

@SanthoshRaju91 , i did not the solution too. i think too, the library does not support list files in request body. (

@thim81
Copy link
Collaborator

thim81 commented Aug 9, 2022

Correct, currently the postman-to-k6 library is not fully capable of handling "files".
I still have to investigate if this is a bug or feature.

If anybody has a solution, feel free to create PR.

@thim81
Copy link
Collaborator

thim81 commented Jan 14, 2023

@Barolina @SanthoshRaju91

It took a long time but we just released v.18.7 of postman-to-k6, which introduces the support for file uploads.
The conversion from Postman uploads can take various shapes, so I tried to bring support for the binary upload.

If the issue is resolved, feel free to close this item.
Let me know if you have other use cases or run into other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants