I know this question has been already asked but I couldn't find any suitable solution.
I'm trying to make a post request. The API needs a x-www-form-urlencoded body format so I ended up doing like so:
login(account: LogAccount): Observable<any> {
const body = new HttpParams()
.set('username', account.username)
.set('password', account.password);
const headers = new HttpHeaders({ 'Content-Type': 'application/x-www-form-urlencoded' });
return this.http.post(`${environment.api.apiUrl}/loginservice`, body.toString(),
{ headers });
}
Which leads to :
Everything works fine using Postman. What am I missing here? Thanks
