I am using this to send a POST request:
this.http.post('/auth', {uaUsername: "test", uaPassword: "test"})
.subscribe((data: Profile) => this.profileProvider.profile = { ...data });
But in chrome network inspect, I see this being sent as a string ({"uaUsername":"test","uaPassword":"test"}), in as a key, and with a blank value, instead of 2 key/value objects
I have a interceptor that sets the header:
request = request.clone({
setHeaders: {
"Content-Type": "application/x-www-form-urlencoded"
}
});
// setting the accept header
request = request.clone({ headers: request.headers.set("Accept", "application/json") });
Without the first interceptor, I saw that instead of the POST request it's doing an OPTIONS request
Any idea what could be wrong here, and why it wont send the right format ? If I use uaUsername=test&uaPassword=test it will work, but I dont want to do that
Thank you