0π
β
It turns out that code in my Vue instance was causing the problem. There I was pushing a csrf value to the X-CSRFTOKEN
header.
I am using Django and DRF. I just switched from SessionAuthentication
to using TokenAuthentication
and now have learned that passing the csrf token is not needed.
The code below is from my main.js
and after removing it the issue is resolved.
The offending code
/* Add the csrf token to the request header */
Vue.http.interceptors.push(function(request, next) {
let token = this.$cookie.get("csrftoken")
request.headers.set('X-CSRFTOKEN', token)
next()
});
Exactly why this caused the TypeError
to be thrown I canβt say.
Source:stackexchange.com