title: Angular 8 error: Http failure during parsing for http
body: <p>I get an error when trying to call a service from Angular 8 app.
  Here is the service:</p>
  
  <pre><code>const httpOptionsPlain = {
    headers: new HttpHeaders({ 'Accept': 'text/plain',
                               'Content-Type': 'text/plain'                             
                               })
  };
  
  @Injectable()
  export class TripService {
  
  public getTripNameById(tripId: number): Observable&lt;any&gt; {
      return this.http.get&lt;any&gt;(`${this.baseUrl}/Trips/Trip/Name/${tripId}`,  httpOptionsPlain);
    }
  </code></pre>
  
  <p>And here is the Java rest api (works fine when calling from the browser):</p>
  
  <pre><code>@GET
  @Path("Trip/Name/{fundId}")
  @Produces("text/plain")     
  public String getTripNameById(@PathParam("tripId") Integer tripId) {        
      return myDao.getNameById(tripId);       
  }
  </code></pre>
  
  <p>I'm getting the error in the chrome console:</p>
  
  <blockquote>
    <p>error: {error: SyntaxError: Unexpected token A in JSON at position 0 at JSON.parse () at XMLHtt…, text: "AAA BBB CCC"}
        headers: HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, lazyInit: ƒ}
        message: "Http failure during parsing for <a href="http://localhost:8080/" rel="noreferrer">http://localhost:8080/</a>...
        name: "HttpErrorResponse"</p>
  </blockquote>
  
  <p>I'm sending plain text so I'm not why the service try to parse json.</p>