I\'d like to unit test a service, however, when running the test, I get the following error:
Uncaught (in promise) SyntaxError: Unexpected token o in
As it turned out I missed the import for Response
:
Before: import { BaseRequestOptions, Http, ResponseOptions } from '@angular/http';
After: import { BaseRequestOptions, Http, Response, ResponseOptions } from '@angular/http';
Without importing Response
from @angular/http
, Response
defaults to ECMAScript APIs.