A
A
Alexander2018-10-03 15:26:23
JavaScript
Alexander, 2018-10-03 15:26:23

How to help Node.js "eat" cookies?

I'm testing the frontend.
Some requests require authorization. Authorization is based on sessions, that is, you log in through the browser by sending a "login / pass" pair to the server, if the server approves, then in response it sends you a cookie - the session identifier, and all subsequent requests go through "credentials:include" and the server determines the user as logged in.
Problems arise in testing these queries. Since I use jest, I assume that these requests are executed by the local Node.js installed on the computer, and of course it simply does not accept this cookie - the session identifier from the server, and although the authorization is successful, the server responds to all subsequent requests "You need to authorize".
What can be done?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question