When sending an endpoint with GET and adding the body, it returns a value. However, when doing it with Angular using HttpClient, the body does not show up to consume the backend with Spring Boot.
Click here to see how to consume with Postman
Consuming with Postman and HttpClient
header = new HttpHeaders().set('Authorization', this.auth.isToken())
.set('Content-Type', 'application/json')
.set('Accept-Language', 'UTF-8')
.set('Cache-Control', 'no-cache');
const url = 'api/servicios/servicios-impuestos-clientes';
const object = JSON.stringify(body);
const options = {
headers: this.header,
body: JSON.stringify({ 'impuestos' [1, 2] }),
// tslint:disable-next-line: quotemark
// tslint:disable-next-line: object-literal-shorthand
params: new HttpParams().append('cliente', 1 + '')
};
console.log(options);
return this.http.get<Servicios>(url, options).pipe(map(result => {
return result;
}));