apideck-libraries/postman-to-k6

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

Barolina opened this issue · 5 comments

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"
]

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

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"
]

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

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.

@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.