axios-mock-adapter icon indicating copy to clipboard operation
axios-mock-adapter copied to clipboard

Default CSRF cookie not read

Open clintonb opened this issue 5 years ago • 0 comments

I am mocking requests that rely on CSRF tokens set in cookies. I configure axios as follows:

axios.defaults.xsrfCookieName = 'csrftoken';
axios.defaults.xsrfHeaderName = 'X-CSRFToken';

These values don't seem to be respected when testing. A code sandbox is linked below. Am I doing something wrong, or is there a bug in the mock library?

https://codesandbox.io/s/friendly-greider-7br5g?fontsize=14&hidenavigation=1&previewwindow=tests&theme=dark&view=editor

clintonb avatar Nov 25 '19 06:11 clintonb