const url = ‘https://xyz.xyz.com/OTCS/cs.exe/api/v1/auth’;
const payload =
{
username: ‘xyx’,
password: ‘xyz#123’,
};
const params ={
headers:{
accept: ‘application/json’,
‘content-type’: ‘application/x-www-form-urlencoded’,
‘user-agent’:
‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36’,
‘sec-ch-ua’: ‘“Not?A_Brand”;v=“8”, “Chromium”;v=“108”, “Google Chrome”;v=“108”’,
‘sec-ch-ua-mobile’: ‘?0’,
‘sec-ch-ua-platform’: ‘“Windows”’,
},
};
const res = http.post(url, payload, params);
const ticket = findBetween(res.body, ‘{"ticket":"’, ‘"}’);
console.log(ticket);
console.log(res.body);
check(res, {
'is authentication ': (r) => res.status === 200,
});
const headers = {
'content-type': 'multipart/form-data; boundary=----WebKitFormBoundaryGLrfLj7AHCVoJz8p',
origin: 'https://eimqaservice.lowes.com',
referer:
'https://xyz.test.com/OTCS/cs.exe?func=ll&objType=144&objAction=create&parentId=23066092&nextURL=%2FOTCS%2Fcs%2Eexe%3Ffunc%3Dll%26objid%3D23066092%26objAction%3Dbrowse%26sort%3Dname%26viewType%3D1',
'upgrade-insecure-requests': '1',
'user-agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36',
'sec-ch-ua': '"Chromium";v="110", "Not A(Brand";v="24", "Google Chrome";v="110"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
}
const data = {
parent_id: '23066092',
type: '144',
name:'checkdoc1232122',
file: http.file(pdf, 'LoadingTicket_ORD654321.pdf'),
};
const response = http.post('https://xyz.zyx.com/OTCS/cs.exe/api/v2/nodes',data, {headers: {otcsticket:`${ticket}`}},{headers: headers});
//console.log(JSON.stringify(response.request.headers));
console.log(response.status);
// console.log(response.status_text);
console.log(JSON.stringify(response.request));
console.log(JSON.stringify(response.body));
check(response, {
'is upload ': (r) => response.status === 200,
});
It is adding slashes in generated token automatically .