Open AlirezaTaji6 opened 4 years ago
I throught the same problem. My solution was make a request to sign in:
const { cpf: login } = await CustomerFactory.merge({ password: "secret" }).create();
const credentials = {
login,
password: "secret",
};
// Make request to login
const response = await request.post("/customers/sessions").send(credentials);
// Get cookies from response
const { header } = response;
// Make request to a private route
const response_with_cookies = await request
.put("/customers/profiles")
.set("Cookie", [...header["set-cookie"]]) // this line I add cookies...
.send(customer_updated);
I hope it helped...
I wrote a test and the router just get signed cookies but I can't set signed cookie for my request