Angular HttpClient XML response

Discussão em 'Angular' iniciado por user2106630, Dezembro 13, 2024.

  1. user2106630

    user2106630 Guest

    const headers = new HttpHeaders({ 'Content-Type': 'text/xml' });
    headers.append('Accept', 'text/xml');
    headers.append('Content-Type', 'text/xml');
    this.http.get('getxmlurl', {headers: headers}).subscribe(response => {
    return '1234';
    });


    Hi I am using Angular HttpClient to make a http get request from a spring controller which returns a XML response.

    The problem I have is the response is ALWAYS NULL even though I can see the xml response from the chrome developer network tab.

    I thought it might be something to do with the request header, Angular defaults to JSON however I am unable to change the request header with the code above. Can someone please advice.

    Thanks

    Continue reading...

Compartilhe esta Página