-2

At the time of sending an endpoint with get and I add the body it returns value, but if I do it with angular with httpcliente, this does not show me the body to consume the backend with spring boot

consuming with postman

Cosuming with postman and httpCliente

Backend - springboot

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;
})); 
Rajan
  • 1,314
  • 2
  • 13
  • 17

1 Answers1

0

Usually a GET does not have a body. That's why most HTTP clients do not allow it.

But it's possible.

Checkout this question: HTTP GET with request body

Simon Martinelli
  • 21,335
  • 3
  • 26
  • 53