Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit efe33a5

Browse files
committed
docs($http): doc fixes suggested by Gina
1 parent 7046d60 commit efe33a5

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

src/service/http.js

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ function $HttpProvider() {
144144
* @requires $injector
145145
*
146146
* @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
149149
* XMLHttpRequest} object or via {@link http://en.wikipedia.org/wiki/JSONP JSONP}.
150150
*
151151
* For unit testing applications that use `$http` service, see
@@ -154,6 +154,10 @@ function $HttpProvider() {
154154
* For a higher level of abstraction, please check out the {@link angular.module.ng.$resource
155155
* $resource} service.
156156
*
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+
*
157161
*
158162
* # General usage
159163
* The `$http` service is a function which takes a single argument — a configuration object —
@@ -173,9 +177,10 @@ function $HttpProvider() {
173177
* });
174178
* </pre>
175179
*
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.
179184
*
180185
*
181186
* # Shortcut methods
@@ -199,7 +204,7 @@ function $HttpProvider() {
199204
* - {@link angular.module.ng.$http#jsonp $http.jsonp}
200205
*
201206
*
202-
* # HTTP Headers
207+
* # Setting HTTP Headers
203208
*
204209
* The $http service will automatically add certain http headers to all requests. These defaults
205210
* can be fully configured by accessing the `$httpProvider.defaults.headers` configuration
@@ -219,7 +224,7 @@ function $HttpProvider() {
219224
* `$httpProvider.defaults.headers.get['My-Header']='value'`.
220225
*
221226
*
222-
* # Request / Response transformations
227+
* # Transforming Requests and Responses
223228
*
224229
* Both requests and responses can be transformed using transform functions. By default, Angular
225230
* applies these transformations:
@@ -234,16 +239,16 @@ function $HttpProvider() {
234239
* - if XSRF prefix is detected, strip it (see Security Considerations section below)
235240
* - if json response is detected, deserialize it using a JSON parser
236241
*
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
240245
* `$httpProvider.defaults.transformResponse` properties of the `$httpProvider`.
241246
*
242247
*
243248
* # Caching
244249
*
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
247252
* response is served from the cache without sending a request to the server.
248253
*
249254
* Note that even if the response is served from cache, delivery of the data is asynchronous in
@@ -256,6 +261,9 @@ function $HttpProvider() {
256261
*
257262
* # Response interceptors
258263
*
264+
* Before you start creating interceptors, be sure to understand the
265+
* {@link angular.module.ng.$q $q and deferred/promise APIs}.
266+
*
259267
* For purposes of global error handling, authentication or any kind of synchronous or
260268
* asynchronous preprocessing of received responses, it is desirable to be able to intercept
261269
* responses for http requests before they are handed over to the application code that
@@ -267,9 +275,6 @@ function $HttpProvider() {
267275
* injected with dependencies (if specified) and returns the interceptor — a function that
268276
* takes a {@link angular.module.ng.$q promise} and returns the original or a new promise.
269277
*
270-
* Before you start creating interceptors, be sure to understand the
271-
* {@link angular.module.ng.$q $q and deferred/promise APIs}.
272-
*
273278
* <pre>
274279
* // register the interceptor as a service
275280
* $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
@@ -300,9 +305,12 @@ function $HttpProvider() {
300305
*
301306
* # Security Considerations
302307
*
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+
*
306314
* Both server and the client must cooperate in order to eliminate these threats. Angular comes
307315
* pre-configured with strategies that address these issues, but for this to work backend server
308316
* cooperation is required.

0 commit comments

Comments
 (0)