- Latest Forum Post
- NullInjectorError: No provider for ActivatedRoute! (Angular)
- error NG8002: Can't bind to 'routerLink' since it isn't a known property of 'a' (Angular)
- Property has no initializer and is not definitely assigned in the constructor (Angular)
- package javax.servlet.annotation does not exist (Java EE)
- SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" (Java EE)
I have worked on code which i have given link above. it has worked for me when i run it independently.
but when i apply this same code in my project [ angular4 with spring boot micro services] it was giving error related to X-XSRF TOKEN as follows,
[{“timestamp”:1528350053314,”status”:403,”error”:”Forbidden”,”message”:”Invalid CSRF Token ‘null’ was found on the request parameter ‘_csrf’ or header ‘X-XSRF-TOKEN’.”,”path”:”/core-location/post”}] .
Here i need to pass some headers like X-XSRF TOKEN so passed headers as follows,
formdata.append(‘file’, file);
formdata.append(‘Content-Type’, ‘application/json’);
formdata.append(‘Accept’,
application/json
);formdata.append(‘X-XSRF-TOKEN’, this._cookieService.get(“XSRF-TOKEN”));
const req = new HttpRequest(‘POST’,’http://localhost:8088/core-location/post’, formdata, {
reportProgress: true,
responseType: ‘text’
});
return this.http.request(req);
}
}
After passing headers also its giving me same error and also file is not going to backend[springboot]. How to pass headers in the request.
please provide solution for this.
Thanks and Regards
Shakti Lohar