0
I need to make an http request to log in to my Ionic application, but my function needs to send the data as x-www-form-urlencoded, tried several different ways but still could not.
public login(credenciais):Observable<any>{
const formData = new FormData()
formData.append('email', credenciais.email);
formData.append('password', credenciais.password);
return this._http.post<any>(AppSettings.API_ENDPOINT + 'loginnovo',
formData, {observe: 'response'
}
)
}
This way I get:
Http Failure During Parsing
I also tried to:
public login(credenciais):Observable<any>{
return this._http.post<any>(AppSettings.API_ENDPOINT + 'loginnovo',
{email: credenciais.password,
password: credenciais.password},
{observe: 'response'
}
)
}
This way I get an Http Failure During Parsing If I check on Request Payload, I have:
{email: "[email protected]", password: "1234"} email : "[email protected]" password : "1234"
if you send only the credentials object does not work?
– Lucas Brogni
I believe that this way it sends as form data, because as return I should receive something in the body, and I get null. When I test for the form-date in Postman, I also get null, when I change to x-www-formurlencoded I receive as a return in the body the email I use to log in, so I suppose I’m still sending as form-data
– veroneseComS