I have request in postman
now, i need to implement this request in k6.
{
"requests": [
{
"name": "Upload file",
"type": "POST",
"url": "https://###########/###########/rs/dossier/###########/add",
"header_value": ["Basic ##########","multipart/form-data"],
"header_tag": ["Authorization","Content-Type"],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "content",
"type": "application/pdf",
"src": "DocToAddFilenet1.pdf"
},
{
"key": "document",
"type": "text/plain",
"data": "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <Document> <Code>010001</Code> <Type> <Code>1210</Code> <Name>Load Testing</Name> </Type> <Number>8884545</Number></Document>"
}
]
},
"expectedStatus": 200
}
]
}
this is the json file that passes data to the main script.js file
let requests = {
names:{
method:GetType,
url: urlTemplate,
body:body_b,
params:authTemplate
}
}
this is the request method in script.js file
I tried, but there are errors.
I’m just starting to study k6, help me to implement this request in k6.