Skip to content

Latest commit

 

History

History
107 lines (61 loc) · 5.66 KB

File metadata and controls

107 lines (61 loc) · 5.66 KB
graph LR
    HttpClient["HttpClient"]
    HttpHandler["HttpHandler"]
    HttpInterceptor["HttpInterceptor"]
    HttpBackend["HttpBackend"]
    HttpXhrBackend["HttpXhrBackend"]
    HttpRequest["HttpRequest"]
    HttpResponse["HttpResponse"]
    HttpHeaders["HttpHeaders"]
    HttpClient -- "sends" --> HttpRequest
    HttpClient -- "receives" --> HttpResponse
    HttpHandler -- "receives" --> HttpRequest
    HttpHandler -- "returns" --> HttpResponse
    HttpInterceptor -- "processes" --> HttpRequest
    HttpInterceptor -- "forwards to" --> HttpHandler
    HttpInterceptor -- "processes" --> HttpResponse
    HttpBackend -- "receives" --> HttpRequest
    HttpBackend -- "creates and returns" --> HttpResponse
    HttpXhrBackend -- "implements" --> HttpBackend
    HttpRequest -- "uses" --> HttpHeaders
    HttpResponse -- "contains" --> HttpHeaders
    click HttpClient href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/angular/HttpClient.md" "Details"
    click HttpHandler href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/angular/HttpHandler.md" "Details"
Loading

CodeBoardingDemoContact

Details

The Angular HTTP subsystem provides a robust and extensible mechanism for making HTTP requests. At its core, the HttpClient service initiates outgoing HttpRequest objects. These requests then flow through a chain of HttpInterceptors, which can inspect, modify, or even short-circuit the requests and their corresponding HttpResponse objects. Each HttpInterceptor delegates to the next HttpHandler in the chain. The final HttpHandler in this pipeline is typically an HttpBackend implementation, such as HttpXhrBackend, which dispatches the HttpRequest to the actual server and creates the HttpResponse. Upon receiving a response, it travels back through the interceptor chain to the HttpClient, allowing for further processing before being delivered to the application. Both HttpRequest and HttpResponse objects utilize HttpHeaders for managing request and response metadata.

HttpClient [Expand]

The primary service for initiating HTTP requests from the application. It serves as the entry point for all outgoing HTTP communication and receives HttpResponse objects.

Related Classes/Methods:

HttpHandler [Expand]

An interface defining the handle(request: HttpRequest): Observable method. It is the fundamental contract for any component participating in the HTTP request pipeline, enabling a chain of responsibility.

Related Classes/Methods:

HttpInterceptor

An interface for intercepting and transforming HTTP requests and responses. Interceptors can modify outgoing requests, handle responses, or even short-circuit the request by returning a synthetic response. It processes HttpRequest objects.

Related Classes/Methods:

HttpBackend

An abstract class implementing HttpHandler, serving as the terminal handler in the HTTP request pipeline. It is responsible for dispatching the request to the actual backend (e.g., using XMLHttpRequest or Fetch API) and creating HttpResponse objects.

Related Classes/Methods:

HttpXhrBackend

A concrete implementation of HttpBackend that uses the browser's XMLHttpRequest API to send HTTP requests. It's the default backend for most browser environments.

Related Classes/Methods:

HttpRequest

Represents an outgoing HTTP request, encapsulating the method, URL, headers, and body. It is an immutable object.

Related Classes/Methods:

HttpResponse

Represents an incoming HTTP response, containing the status, status text, headers, and response body. It is also an immutable object.

Related Classes/Methods:

HttpHeaders

A utility class for managing HTTP headers, providing methods for setting, getting, and appending header values.

Related Classes/Methods: