@@ -144,8 +144,8 @@ function $HttpProvider() {
144
144
* @requires $injector
145
145
*
146
146
* @description
147
- * The `$http` service is a core Angular service that is responsible for communication with the
148
- * remote HTTP servers via browser's {@link https://developer.mozilla.org/en/xmlhttprequest
147
+ * The `$http` service is a core Angular service that facilitates communication with the remote
148
+ * HTTP servers via browser's {@link https://developer.mozilla.org/en/xmlhttprequest
149
149
* XMLHttpRequest} object or via {@link http://en.wikipedia.org/wiki/JSONP JSONP}.
150
150
*
151
151
* For unit testing applications that use `$http` service, see
@@ -154,6 +154,10 @@ function $HttpProvider() {
154
154
* For a higher level of abstraction, please check out the {@link angular.module.ng.$resource
155
155
* $resource} service.
156
156
*
157
+ * The $http API is based on the {@link angular.module.ng.$q deferred/promise APIs} exposed by
158
+ * the $q service. While for simple usage patters this doesn't matter much, for advanced usage,
159
+ * it is important to familiarize yourself with these apis and guarantees they provide.
160
+ *
157
161
*
158
162
* # General usage
159
163
* The `$http` service is a function which takes a single argument — a configuration object —
@@ -173,9 +177,10 @@ function $HttpProvider() {
173
177
* });
174
178
* </pre>
175
179
*
176
- * Since the returned value is a Promise object, you can also use the `then` method to register
177
- * callbacks, and these callbacks will receive a single argument – an object representing the
178
- * response. See the api signature and type info below for more details.
180
+ * Since the returned value of calling the $http function is a Promise object, you can also use
181
+ * the `then` method to register callbacks, and these callbacks will receive a single argument –
182
+ * an object representing the response. See the api signature and type info below for more
183
+ * details.
179
184
*
180
185
*
181
186
* # Shortcut methods
@@ -199,7 +204,7 @@ function $HttpProvider() {
199
204
* - {@link angular.module.ng.$http#jsonp $http.jsonp}
200
205
*
201
206
*
202
- * # HTTP Headers
207
+ * # Setting HTTP Headers
203
208
*
204
209
* The $http service will automatically add certain http headers to all requests. These defaults
205
210
* can be fully configured by accessing the `$httpProvider.defaults.headers` configuration
@@ -219,7 +224,7 @@ function $HttpProvider() {
219
224
* `$httpProvider.defaults.headers.get['My-Header']='value'`.
220
225
*
221
226
*
222
- * # Request / Response transformations
227
+ * # Transforming Requests and Responses
223
228
*
224
229
* Both requests and responses can be transformed using transform functions. By default, Angular
225
230
* applies these transformations:
@@ -234,16 +239,16 @@ function $HttpProvider() {
234
239
* - if XSRF prefix is detected, strip it (see Security Considerations section below)
235
240
* - if json response is detected, deserialize it using a JSON parser
236
241
*
237
- * These transformations can be overridden locally by specifying transform functions as
238
- * `transformRequest` and/or `transformResponse` properties of the config object. To globally
239
- * override the default transforms, override the `$httpProvider.defaults.transformRequest` and
242
+ * To override these transformation locally, specify transform functions as `transformRequest`
243
+ * and/or `transformResponse` properties of the config object. To globally override the default
244
+ * transforms, override the `$httpProvider.defaults.transformRequest` and
240
245
* `$httpProvider.defaults.transformResponse` properties of the `$httpProvider`.
241
246
*
242
247
*
243
248
* # Caching
244
249
*
245
- * You can enable caching by setting the configuration property `cache` to `true`. When the
246
- * cache is enabled, `$http` stores the response from the server in local cache. Next time the
250
+ * To enable caching set the configuration property `cache` to `true`. When the cache is
251
+ * enabled, `$http` stores the response from the server in local cache. Next time the
247
252
* response is served from the cache without sending a request to the server.
248
253
*
249
254
* Note that even if the response is served from cache, delivery of the data is asynchronous in
@@ -256,6 +261,9 @@ function $HttpProvider() {
256
261
*
257
262
* # Response interceptors
258
263
*
264
+ * Before you start creating interceptors, be sure to understand the
265
+ * {@link angular.module.ng.$q $q and deferred/promise APIs}.
266
+ *
259
267
* For purposes of global error handling, authentication or any kind of synchronous or
260
268
* asynchronous preprocessing of received responses, it is desirable to be able to intercept
261
269
* responses for http requests before they are handed over to the application code that
@@ -267,9 +275,6 @@ function $HttpProvider() {
267
275
* injected with dependencies (if specified) and returns the interceptor — a function that
268
276
* takes a {@link angular.module.ng.$q promise} and returns the original or a new promise.
269
277
*
270
- * Before you start creating interceptors, be sure to understand the
271
- * {@link angular.module.ng.$q $q and deferred/promise APIs}.
272
- *
273
278
* <pre>
274
279
* // register the interceptor as a service
275
280
* $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
@@ -300,9 +305,12 @@ function $HttpProvider() {
300
305
*
301
306
* # Security Considerations
302
307
*
303
- * When designing web applications your design needs to consider security threats from
304
- * {@link http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx
305
- * JSON Vulnerability} and {@link http://en.wikipedia.org/wiki/Cross-site_request_forgery XSRF}.
308
+ * When designing web applications, consider security threats from:
309
+ *
310
+ * - {@link http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx
311
+ * JSON Vulnerability}
312
+ * - {@link http://en.wikipedia.org/wiki/Cross-site_request_forgery XSRF}
313
+ *
306
314
* Both server and the client must cooperate in order to eliminate these threats. Angular comes
307
315
* pre-configured with strategies that address these issues, but for this to work backend server
308
316
* cooperation is required.
0 commit comments