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):
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.
Ah, glad you figured it out. 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.