Thursday 27 August 2020

DELETE Works in postman but not with Angular frontend

Hi all!I am trying to make a delete request to my NodeJS server running with CORS enabled.This is how I have set up my CORS:app.use(cors({ origin: settings.CORS, allowedHeaders: '*' })); Deleting with postman works fine, no problems, no errors, item gets deleted that's it. However, when I'm trying to make the delete request from my browser it doesn't come through. Im not getting any errors, the frontend function runs fine up until the http delete request which just isnt coming through.My frontend request: delete(user) { let headers = new HttpHeaders({ 'Content-type': 'application/json', 'Access-Control-Request-Headers': 'DELETE', }); return this.http.delete(this.baseApi.baseAPI + `users/${user._id}`, { headers: headers, }); } If anyone knows whatsup I'd like to know cuz its driving me nuts :PThanks in advance!

Submitted August 27, 2020 at 04:51PM by rexorbrave

No comments:

Post a Comment