Angular’s $http service looks deceptively simple: It’s really just a function that executes HTTP request using the browser’s built–in XMLHttpRequest support.
Issue Checklist
[ ] That HTTP requests in Angular are handled by two collaborating services: $http and $http-Backend. The backend may be overridden to provide an alternative transport or to mock it out during testing.
[ ] That $http is a function that takes a request configuration object and returns a Promise that will later be resolved (or rejected) when a response arrives.
[ ] That $http kicks off a digest on the $rootScope when the response arrives – unless useApplyAsync is enabled, in which case it uses $rootScope.$applyAsync to do it later.
[ ] That $http.defaults (and $httpProvider.defaults) allows setting some default configurations that’ll be used for all requests.
[ ] How you can supply HTTP headers by providing a headers object in the request configuration.
[ ] That Angular has some default headers, such as Accept and Content-Type, but that you can override them using $http.defaults.
[ ] That default and request–specific headers are merged case–insensitively, since that’s how headers work according to the HTTP standard.
[ ] That request header values may also be functions that return the concrete header values when called.
[ ] That response headers are available through the headers function attached to the response object, and how that function treats header names case–insensitively.
[ ] That response headers are parsed lazily only when requested.
[ ] How CORS authorization can be enabled by supplying the withCredentials flag in request objects.
[ ] That both request and response bodies can be transformed using transforms that are registered with the transformRequest and transformResponse attributes, which may be either supplied in $http.defaults or individual request objects.
[ ] That Angular uses request and response transforms to do JSON serialization and parsing by default.
[ ] How request data is serialized to JSON when it is an array or an object, unless it is a special object like a Blob, File, or FormData.
[ ] How response data is parsed as JSON when it’s either specified as such with a Content-Type header, or when it merely looks like JSON.
[ ] How single and multi–value URL parameters can be supplied, and how they are escaped and attached to the request URL.
[ ] That objects are serialized into JSON when used as URL parameters.
[ ] That Dates are serialized into their ISO 8601 representation when used as URL parameters.
[ ] That you can customize the way URL parameters are serialized by providing your own serializer.
[ ] That there’s one built–in alternative URL parameter serializer that attempts to be compatible with jQuery’s form serialization.
[ ] That three short–hand methods are provided for HTTP methods without bodies: $http.get, $http.head, and $http.delete.
[ ] That three short–hand methods are provided for HTTP methods that do have bodies: $http.post, $http.put, and $http.patch.
[ ] How interceptor factories can be registered directly to the $httpProvider or as references to existing factories.
[ ] That interceptors are objects with one or more of the following methods: request, requestError, response, and responseError.
[ ] How interceptors form a Promise–based pipeline for processing the HTTP request and response.
[ ] That response interceptors are invoked in reverse order compared to how they were registered.
[ ] How $http extends Promise with two methods useful for dealing with HTTP responses: success and error.
[ ] How a request can be aborted with a Promise–based or a numeric timeout attribute.
[ ] That all ongoing requests are made available through the array $http.pendingRequests.
[ ] How $http can use the $applyAsync feature of Scope to skip unnecessary digests when several HTTP responses arrive in quick succession.
[ ] That the $applyAsync optimization is not enabled by default, and you have to call $http-Provider.useApplyAsync(true) to enable it.
Description
Angular’s
$http
service looks deceptively simple: It’s really just a function that executes HTTP request using the browser’s built–inXMLHttpRequest
support.Issue Checklist
$http
and$http-Backend
. The backend may be overridden to provide an alternative transport or to mock it out during testing.$http
is a function that takes a request configuration object and returns a Promise that will later be resolved (or rejected) when a response arrives.$http
kicks off a digest on the$rootScope
when the response arrives – unlessuseApplyAsync
is enabled, in which case it uses$rootScope.$applyAsync
to do it later.$http.defaults
(and$httpProvider.defaults
) allows setting some default configurations that’ll be used for all requests.headers
object in the request configuration.Accept
andContent-Type
, but that you can override them using$http.defaults
.headers
function attached to the response object, and how that function treats header names case–insensitively.withCredentials
flag in request objects.transformRequest
andtransformResponse
attributes, which may be either supplied in$http.defaults
or individual request objects.Content-Type
header, or when it merely looks like JSON.$http.get
,$http.head
, and$http.delete
.$http.post
,$http.put
, and$http.patch
.$httpProvider
or as references to existing factories.request
,requestError
,response
, andresponseError
.$http
extends Promise with two methods useful for dealing with HTTP responses:success
anderror
.$http.pendingRequests
.$http
can use the$applyAsync
feature of Scope to skip unnecessary digests when several HTTP responses arrive in quick succession.$applyAsync
optimization is not enabled by default, and you have to call$http-Provider.useApplyAsync(true)
to enable it.All issues in milestone: 0.5.0 milestone
Assignees