I am trying to make an API Client test using HTTP client that has a simple plain cookie set.
When I try sending a request using withPlainCookie I can see in the route under test that the cookie is base64 encoded json string of my plain cookie value set in the test.
I would like to be able to disable the encoding on that cookie so that in the route handler I can access ctx.request.plainCookie('sauce', { encoded: false }) and retrieve the value.
Below are some example code:
// test
test('It creates a taco', async ({ client, assert }) => {
const companyName = 'Acme Inc'
const response = await client
.post('/tacos')
.withPlainCookie('sauce','spicy')
.form({ toppings: [ 'cilantro'] })
.withCsrfToken()
response.assertStatus(200)
const taco = await Taco.findBy({ toppings: 'cilantro' })
assert.ok(taco, 'It should make a tacos')
})
In the route when I inspect ctx.request.plainCookie('sauce') I have a string like this:
eyJtZXNzYWdlIjogInNwaWN5In0=
Package version
7.2.3
Describe the bug
I am trying to make an API Client test using HTTP client that has a simple plain cookie set.
When I try sending a request using
withPlainCookie
I can see in the route under test that the cookie is base64 encoded json string of my plain cookie value set in the test.I would like to be able to disable the encoding on that cookie so that in the route handler I can access
ctx.request.plainCookie('sauce', { encoded: false })
and retrieve the value.Below are some example code:
In the route when I inspect
ctx.request.plainCookie('sauce')
I have a string like this:eyJtZXNzYWdlIjogInNwaWN5In0=
which is a json object like this:
and should be a simply
spicy
.Thanks
Reproduction repo
No response