POST / PUT / DELETE 통신 시 csrf error가 발생 할 때
- Tests에 코드 추가
var xsrfCookie = postman.getResponseCookie("csrftoken");
postman.setGlobalVariable('csrftoken', xsrfCookie.value);
- Headers에 Key / Value 추가
- Key : X-CSRFToken
- Value : {{csrftoken}}
원래는 cookie에 있는 csrftoken value를 가져와서 value에 넣어주는게 정석이다.
'Postman' 카테고리의 다른 글
Postman 실행 (0) | 2022.06.18 |
---|