testing HTTP request withPlainCookie() without encoding #4649
-
Hello 👋 When I try sending a request using I would like to be able to disable the encoding on that cookie. 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 which is a json object like this: { "message": "spicy"} Please advise how I can pass a plaincookie without the json / base64. when I test with my own client I can send the plain cookie and the routes work. The issue is only under test using thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can read the cookie as follows via request. ctx.request.plainCookie('sauce', {
encoded: false
}) But I agree, it will be nice to allow non-encoded cookies via tests too. Can you please file an issue in https://github.com/adonisjs/http-server repo for the same and I will look into it |
Beta Was this translation helpful? Give feedback.
You can read the cookie as follows via request.
But I agree, it will be nice to allow non-encoded cookies via tests too. Can you please file an issue in https://github.com/adonisjs/http-server repo for the same and I will look into it