HTTP header fields are a list of strings sent and received by both the client program and server on every HTTP request and response. e.success(sampleData); // The flush method completes the request using the data passed to it. For example, the @page directive specifies a routable component with a route template and can be reached directly by a user's request in the browser at a specific URL. B The intercept() method could inspect that observable and alter it before returning it to the caller. So if there is no error, JSON object with logged users data will receive. The Cache-Control general-header field is used to specify directives which MUST be obeyed by all caching mechanisms along the request/response chain. Additionally, we could assert the requests method (GET, POST, ) Next we call flush on the mock request and pass in our mock users. The Promise API is a new feature of ECMAScript 6 (ES2015), but it has good browser support already. Trying to add a duplicate: 409 Conflict ("The request could not be completed due to a conflict with the current state of the resource.") src/app/app.module.ts (imports array excerpt) content_copy @ NgModule ({imports: [HttpClientModule,],}) Simulate a data serverlink. Finally, we call the verify method on our HttpTestingController instance to ensure that there are no outstanding requests to be made. Every Angular application has at least one component, the root component that connects a component hierarchy with the page document object model (DOM). HTTP interceptors are now available via the new HttpClient from @angular/common/http, as of Angular 4.3.x versions and beyond.. When you get started with Angular web application development, one of the common scenarios encountered is how to pass data from Angular to REST API. Share Improve this answer Render an HTML template with a