What is the easiest way to mock the response returned by Http get() in Angular 2?
I have local data.json file in my working directory, and I want get() to return response containing that data as a payload, simulating the rest api.
Documents for configuring the Backend object for Http seemed somewhat obscure and overcomplicated for such a simple task.
Backendis obscure. DI is a major and basic building block of Angular2 and this is exactly the use case DI is made for. What's complicated withMockBackend, provide(XHRBackend, {useExisting: MockBackend}). It's simple and straight-forward.