Angular HTTP library has separate methods for each of the main HTTP verbs used for communicating with an API. All of these methods return an Observable Response object, and all of them can accept RequestOptionsArgs. Request is a special method that allows you to provide a Request object instead of a URL string, so it can be any HTTP verb:
Angular HTTP Method | HTTP Verb |
this.http.get(url: string, [RequestOptionsArgs]) | GET |
this.http.post(url: string, [RequestOptionsArgs]) | POST |
this.http.put(url: string, [RequestOptionsArgs]) | PUT |
this.http.delete(url: string, [RequestOptionsArgs]) | DELETE |
this.http.patch(url: string, [RequestOptionsArgs]) | PATCH |
this.http.head(url: string, [RequestOptionsArgs]) | HEAD |
this.http.options(url: string, [RequestOptionsArgs]) | OPTIONS |
this.http.request(url: string|Request, [RequestOptionsArgs]) | any |
The ResponseOptionsArgs interface provides a common set of options that can be provided to any of the HTTP library's methods. These options can be customized in a number of ways and are merged with the default options for each HTTP method, as follows:
Option | Type | Description |
url | url|string | The URL for the HTTP request |
method | string|RequestMethod | The HTTP method must be a valid verb from the preceding list |
params | string|URLSearchParams | URL parameters appended to the URL |
headers | Headers | Additional HTTP Headers passed along in the HTTP request |
body | any | The HTTP body property passed along in the HTTP request |
withCredentials | boolean | Allows XMLHttpRequest cross-site Access-Control-based cookies or authorization headers |
responseType | ResponseContentType | Sets the acceptable response types allowed based on the fetch responseType standard |