where should i add it? in GET
@Orela could you please give more details in what you’re attempting to achieve so we try to help you.
If you’re looking how to add headers to your request checkout this page.
Just trying to emulate Postman , the script convertor created file with
import “./libs/shim/core.js”;
and i dont know from where to get it
so i am trying to create it manualy
const params = {headers:
{‘Content-Type’: ‘application/json’,‘Accept’: ‘/’, ‘Accept-Encoding’: ‘gzip, deflate, br’,‘Connection’:‘keep-alive’ ,‘compression’:‘gzip, deflate, br’},}
its air gaped env , and the file (core.js) dose not pass the scannig
here is the code
import http from 'k6/http';
import { check, group, sleep } from 'k6';
const SLEEP_DURATION = 0.1;
export const options = {insecureSkipTLSVerify: true, vus: 1, duration: '1s',
tlsAuth: [{domains: ['ep.domain.local'],cert: open('C:\\Users\\DODODOD\\Desktop\\testing\\crt.pem'),key: open('C:\\Users\\DODODODO\\Desktop\\testing\\key.pem'),}, ],};
//'Content-Type: application/json'
export default function () {
let url = 'https://ep.domain.local/nt2cr/v1/u1'
const params = {
headers:{
'Content-Type': 'application/json',
}
,};
// {'Content-Type': 'application/json','Accept': '*/*', 'Accept-Encoding': 'gzip, deflate, br','Connection':'keep-alive' ,'compression':'gzip, deflate, br'},}
let body=JSON.stringify(
{
"_param_BLIIF": 963335,
"_param_SUG_CHN": 34033,
"_param_MIS_CHN": 1248333228865,
"_Jjjj_TA_ERECH_from": "2000-01-01",
"_Jjjj_TA_ERECH_to": "2022-01-01"
});
group('nt2cr', (_) => {
// send request
const res = http.get(url,body,{'Content-Type': 'application/json',});
check(res, {'is status 200': (r) => r.status === 200, });
});
}
I think you might want to pass the params
const you have initialized above, same as you did with body?!
const res = http.get(url,body,params);
If not then I didn’t understand your question.
i just tried both ways , neither is working
answer : i used http.request
in http.get , its imposible to pass body