testing HTTP request withPlainCookie() always encodes the cookie
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:
// 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=
which is a json object like this:
{ "message": "spicy"}
and should be a simply spicy.
Thanks
Reproduction repo
No response
created from https://github.com/orgs/adonisjs/discussions/4649
Hey @jared-f! 👋🏻
Would you mind creating a PR with a failing test to help illustrate the issue?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.