title: SyntaxError: Unexpected end of input in Angular 5 service
body: <p>I know that it is a common problem, but I still don't understand why it is reproduced in my case.  Сouldn't find an answer in a few days.</p>
  
  <p>Folowing a part of the Angular service:</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { Router } from '@angular/router';
  import { Response, RequestOptionsArgs, ResponseContentType } from '@angular/http';
  import { Http, RequestOptions, Request, RequestMethod, Headers } from '@angular/http';
  import { Observable } from 'rxjs/Observable';
  import { map } from 'rxjs/operators';
  
  @Injectable()
  export class BaseService {
      private headers: Headers = new Headers({ 'Content-Type': 'application/json; charset=utf-8', 'Data-Type': 'json' });
  
      constructor(private http: Http, private router: Router, ) {
      }
  
      public get&lt;T&gt;(url: string, options?: RequestOptionsArgs): Promise&lt;T&gt; {
          return this.http.get(url, options)
              .toPromise()
              .then(response =&gt; response.json() as T)
              .catch(this.handleError.bind(this));
      }
  
      public handleError(error: any) {
          if (error.status === 400) {
              switch (error.statusText) {
                  case 'Authentication':
                      this.router.navigate(['/error/auth']);
                      break;
                  default:
                      return Promise.reject(error);
              }
              return;
          }
          return Promise.reject(error.toString());
      }
  }
  </code></pre>
  
  <p>Folowing method called base method:</p>
  
  <pre><code>getSearchResultTable(hash: number): Promise&lt;Prices[]&gt; {
      const tmp = this.baseService.get&lt;Prices[]&gt;(this.apiUrl + hash);
       return tmp;
  }
  </code></pre>
  
  <p>Json that's returned from server is valid. I checked it one some online service.</p>
  
  <p>But I see <code>SyntaxError: Unexpected end of input</code> error in <code>Response</code> when trying to debug.</p>
  
  <p>Call Stack:</p>
  
  <pre><code>SyntaxError: Unexpected end of input
      at BaseService.get (webpack-internal:///../../../../../src/app/search-module/services/base.service.ts:36:14)
      at SearchResultService.getSearchResultTable (webpack-internal:///../../../../../src/app/search-module/services/search-result.service.ts:30:36)
      at SearchResultPageComponent.ngOnInit (webpack-internal:///../../../../../src/app/search-module/pages/search-result/search-result.component.ts:24:34)
      at checkAndUpdateDirectiveInline (webpack-internal:///../../../core/esm5/core.js:12291:19)
      at checkAndUpdateNodeInline (webpack-internal:///../../../core/esm5/core.js:13794:20)
      at checkAndUpdateNode (webpack-internal:///../../../core/esm5/core.js:13737:16)
      at debugCheckAndUpdateNode (webpack-internal:///../../../core/esm5/core.js:14609:76)
      at debugCheckDirectivesFn (webpack-internal:///../../../core/esm5/core.js:14550:13)
      at Object.eval [as updateDirectives] (ng:///SearchModule/SearchResultPageComponent_Host.ngfactory.js:9:5)
      at Object.debugUpdateDirectives [as updateDirectives] (webpack-internal:///../../../core/esm5/core.js:14535:21)
  </code></pre>
  
  <p>I'm using latest version of Angular.</p>