Can cookies in params have quotes?

I’m running into an issue where the cookie name contains special characters and cannot be written without quotes. I’m trying with quotes, but I’m worried that quotes invalidates the cookie (I’m a k6/javascript newbie):

let attemptAccountLoginParams = {

    cookies: {

        'ASP.NET_SessionId': `${aspNetSessionId}`


    headers: { 

        'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'



Can someone comment?

Hi @crichmond,

if I’m understanding your question correctly, you need the cookie name itself to be quoted?

You can add double quotes inside single quotes, like so:

cookies: {
    '"ASP.NET_SessionID"': `${aspNetSessionId}`

Wait… I’m not sure if you understand.

The expected format is:
cookies: {
ASP.NET_SessionID: ${aspNetSessionId}

Which cannot be done due to special characters in the literal. So I want to know if the following will also work without invalidating the cookie:
cookies: {
‘ASP.NET_SessionID’: ${aspNetSessionId}

Sorry if I didn’t make that clear.

I also don’t know how to mark blocks of code if you could inform me of that.

Solved… what I attempted does work, proven with debug command line flag: --http-debug

Ah, glad you figured it out. :slight_smile: In JavaScript property names in object literals can either be literal strings, numbers or valid identifier names. Since there’s a period in ASP.NET_SessionID it can’t be a valid identifier, so if you quote it with single or double quotes as in your example, that should set the right cookie in the request.

And the forum uses Markdown for formatting, so you can use the editor formatting buttons, or write in Markdown directly. See some examples here. For the code blocks you can use three backticks before and after the text.