Token value fetched from findbetween is getting changed automatically in next request

I am trying to pass my token value as it is but while fetching it , it is coming like this:

INFO[0004] {“ticket”:“YG26kRaQrN3y6Y3qyOVHTfvh/jjx1ZPOEadKe58nH/vzcyhbCCOPKCk0wYp3trqsB+kuK0cooQt0ubF6swz20vWoeGPli4zaF9sXtwKgc9j6WnjjKMRSFQ==”} source=console

But while I am sending in next request it is getting changed automatically adding extra \ to the ticket.

INFO[0005] {“method”:“POST”,“url”:“",“headers”:{“Content-Type”:["multipart/form-data; boundary=286aca129b4c0d5ffd328f7f78098e94e5f3344f8aa326a9778cd6729e97”],“User-Agent”:[“k6/0.37.0 (”],“Otcsticket”:[“YG26kRaQrN3y6Y3qyOVHTfvh\/jjx1ZPOEadKe58nH\/vzcyhbCCOPKCk0wYp3trqsB+kuK0cooQt0ubF6swz20vWoeGPli4zaF9sXtwKgc9j6WnjjKMRSFQ==”]},"

how to avoid this extra \ slashes in next request ?

Hello @ShreeDash can you share code for more understand?

1 Like

const url = ‘’;
const payload =
username: ‘xyx’,
password: ‘xyz#123’,

const params ={
accept: ‘application/json’,
‘content-type’: ‘application/x-www-form-urlencoded’,
‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ 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 =, payload, params);
const ticket = findBetween(res.body, ‘{"ticket":"’, ‘"}’);

    check(res, {
        'is authentication ': (r) => res.status === 200,
    const headers = {
        'content-type': 'multipart/form-data; boundary=----WebKitFormBoundaryGLrfLj7AHCVoJz8p',
        origin: '',
        'upgrade-insecure-requests': '1',
          'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ 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',
    file: http.file(pdf, 'LoadingTicket_ORD654321.pdf'),
    const response ='',data, {headers: {otcsticket:`${ticket}`}},{headers: headers});
      //  console.log(response.status_text);
    check(response, {
        'is upload ': (r) => response.status === 200,

It is adding slashes in generated token automatically .

The ticket value while fetch from response is

Hello @ShreeDash Token generated has escape backslash form host server.

Hello @ShreeDash please confirm headers token received from server if is same as one sent by request.