@@ -437,7 +437,9 @@ function $HttpProvider() {
437
437
*
438
438
* ## General usage
439
439
* The `$http` service is a function which takes a single argument — a {@link $http#usage configuration object} —
440
- * that is used to generate an HTTP request and returns a {@link ng.$q promise}.
440
+ * that is used to generate an HTTP request and returns a {@link ng.$q promise} that is
441
+ * resolved (request success) or rejected (request failure) with a
442
+ * {@link ng.$http#$http-returns response} object.
441
443
*
442
444
* ```js
443
445
* // Simple GET request example:
@@ -453,24 +455,6 @@ function $HttpProvider() {
453
455
* });
454
456
* ```
455
457
*
456
- * The response object has these properties:
457
- *
458
- * - **data** – `{string|Object}` – The response body transformed with the transform
459
- * functions.
460
- * - **status** – `{number}` – HTTP status code of the response.
461
- * - **headers** – `{function([headerName])}` – Header getter function.
462
- * - **config** – `{Object}` – The configuration object that was used to generate the request.
463
- * - **statusText** – `{string}` – HTTP status text of the response.
464
- * - **xhrStatus** – `{string}` – Status of the XMLHttpRequest (`complete`, `error`, `timeout` or `abort`).
465
- *
466
- * A response status code between 200 and 299 is considered a success status and will result in
467
- * the success callback being called. Any response status code outside of that range is
468
- * considered an error status and will result in the error callback being called.
469
- * Also, status codes less than -1 are normalized to zero. -1 usually means the request was
470
- * aborted, e.g. using a `config.timeout`.
471
- * Note that if the response is a redirect, XMLHttpRequest will transparently follow it, meaning
472
- * that the outcome (success or error) will be determined by the final response status code.
473
- *
474
458
*
475
459
* ## Shortcut methods
476
460
*
@@ -845,16 +829,44 @@ function $HttpProvider() {
845
829
* See {@link $http#caching $http Caching} for more information.
846
830
* - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise}
847
831
* that should abort the request when resolved.
848
- * A numerical timeout or `$timeout` will set `xhrStatus` "timeout", and a resolved promise
849
- * will set it to "abort", following standard XMLHttpRequest behavior.
832
+ *
833
+ * A numerical timeout or a promise returned from {@link ng.$timeout $timeout}, will set
834
+ * the `xhrStatus` in the {@link $http#$http-returns response} to "timeout", and any other
835
+ * resolved promise will set it to "abort", following standard XMLHttpRequest behavior.
836
+ *
850
837
* - **withCredentials** - `{boolean}` - whether to set the `withCredentials` flag on the
851
838
* XHR object. See [requests with credentials](https://developer.mozilla.org/docs/Web/HTTP/Access_control_CORS#Requests_with_credentials)
852
839
* for more information.
853
840
* - **responseType** - `{string}` - see
854
841
* [XMLHttpRequest.responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype).
855
842
*
856
- * @returns {HttpPromise } Returns a {@link ng.$q `Promise}` that will be resolved to a response object
857
- * when the request succeeds or fails.
843
+ * @returns {HttpPromise } A {@link ng.$q `Promise}` that will be resolved (request success)
844
+ * or rejected (request failure) with a response object.
845
+ *
846
+ * The response object has these properties:
847
+ *
848
+ * - **data** – `{string|Object}` – The response body transformed with
849
+ * the transform functions.
850
+ * - **status** – `{number}` – HTTP status code of the response.
851
+ * - **headers** – `{function([headerName])}` – Header getter function.
852
+ * - **config** – `{Object}` – The configuration object that was used
853
+ * to generate the request.
854
+ * - **statusText** – `{string}` – HTTP status text of the response.
855
+ * - **xhrStatus** – `{string}` – Status of the XMLHttpRequest
856
+ * (`complete`, `error`, `timeout` or `abort`).
857
+ *
858
+ *
859
+ * A response status code between 200 and 299 is considered a success status
860
+ * and will result in the success callback being called. Any response status
861
+ * code outside of that range is considered an error status and will result
862
+ * in the error callback being called.
863
+ * Also, status codes less than -1 are normalized to zero. -1 usually means
864
+ * the request was aborted, e.g. using a `config.timeout`. More information
865
+ * about the status might be available in the `xhrStatus` property.
866
+ *
867
+ * Note that if the response is a redirect, XMLHttpRequest will transparently
868
+ * follow it, meaning that the outcome (success or error) will be determined
869
+ * by the final response status code.
858
870
*
859
871
*
860
872
* @property {Array.<Object> } pendingRequests Array of config objects for currently pending
@@ -1104,8 +1116,9 @@ function $HttpProvider() {
1104
1116
*
1105
1117
* @param {string|TrustedObject } url Absolute or relative URL of the resource that is being requested;
1106
1118
* or an object created by a call to `$sce.trustAsResourceUrl(url)`.
1107
- * @param {Object= } config Optional configuration object. See https://docs.angularjs.org/api/ng/service/$http#usage
1108
- * @returns {HttpPromise } Future object
1119
+ * @param {Object= } config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}.
1120
+ * @returns {HttpPromise } A Promise that will be resolved or rejected with a response object.
1121
+ * See {@link ng.$http#$http-returns `$http()` return value}.
1109
1122
*/
1110
1123
1111
1124
/**
@@ -1117,8 +1130,9 @@ function $HttpProvider() {
1117
1130
*
1118
1131
* @param {string|TrustedObject } url Absolute or relative URL of the resource that is being requested;
1119
1132
* or an object created by a call to `$sce.trustAsResourceUrl(url)`.
1120
- * @param {Object= } config Optional configuration object. See https://docs.angularjs.org/api/ng/service/$http#usage
1121
- * @returns {HttpPromise } Future object
1133
+ * @param {Object= } config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}.
1134
+ * @returns {HttpPromise } A Promise that will be resolved or rejected with a response object.
1135
+ * See {@link ng.$http#$http-returns `$http()` return value}.
1122
1136
*/
1123
1137
1124
1138
/**
@@ -1130,8 +1144,9 @@ function $HttpProvider() {
1130
1144
*
1131
1145
* @param {string|TrustedObject } url Absolute or relative URL of the resource that is being requested;
1132
1146
* or an object created by a call to `$sce.trustAsResourceUrl(url)`.
1133
- * @param {Object= } config Optional configuration object. See https://docs.angularjs.org/api/ng/service/$http#usage
1134
- * @returns {HttpPromise } Future object
1147
+ * @param {Object= } config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}.
1148
+ * @returns {HttpPromise } A Promise that will be resolved or rejected with a response object.
1149
+ * See {@link ng.$http#$http-returns `$http()` return value}.
1135
1150
*/
1136
1151
1137
1152
/**
@@ -1172,8 +1187,9 @@ function $HttpProvider() {
1172
1187
*
1173
1188
* @param {string|TrustedObject } url Absolute or relative URL of the resource that is being requested;
1174
1189
* or an object created by a call to `$sce.trustAsResourceUrl(url)`.
1175
- * @param {Object= } config Optional configuration object. See https://docs.angularjs.org/api/ng/service/$http#usage
1176
- * @returns {HttpPromise } Future object
1190
+ * @param {Object= } config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}.
1191
+ * @returns {HttpPromise } A Promise that will be resolved or rejected with a response object.
1192
+ * See {@link ng.$http#$http-returns `$http()` return value}.
1177
1193
*/
1178
1194
createShortMethods ( 'get' , 'delete' , 'head' , 'jsonp' ) ;
1179
1195
@@ -1186,8 +1202,9 @@ function $HttpProvider() {
1186
1202
*
1187
1203
* @param {string } url Relative or absolute URL specifying the destination of the request
1188
1204
* @param {* } data Request content
1189
- * @param {Object= } config Optional configuration object. See https://docs.angularjs.org/api/ng/service/$http#usage
1190
- * @returns {HttpPromise } Future object
1205
+ * @param {Object= } config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}.
1206
+ * @returns {HttpPromise } A Promise that will be resolved or rejected with a response object.
1207
+ * See {@link ng.$http#$http-returns `$http()` return value}.
1191
1208
*/
1192
1209
1193
1210
/**
@@ -1199,8 +1216,9 @@ function $HttpProvider() {
1199
1216
*
1200
1217
* @param {string } url Relative or absolute URL specifying the destination of the request
1201
1218
* @param {* } data Request content
1202
- * @param {Object= } config Optional configuration object. See https://docs.angularjs.org/api/ng/service/$http#usage
1203
- * @returns {HttpPromise } Future object
1219
+ * @param {Object= } config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}.
1220
+ * @returns {HttpPromise } A Promise that will be resolved or rejected with a response object.
1221
+ * See {@link ng.$http#$http-returns `$http()` return value}.
1204
1222
*/
1205
1223
1206
1224
/**
@@ -1212,8 +1230,9 @@ function $HttpProvider() {
1212
1230
*
1213
1231
* @param {string } url Relative or absolute URL specifying the destination of the request
1214
1232
* @param {* } data Request content
1215
- * @param {Object= } config Optional configuration object. See https://docs.angularjs.org/api/ng/service/$http#usage
1216
- * @returns {HttpPromise } Future object
1233
+ * @param {Object= } config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}.
1234
+ * @returns {HttpPromise } A Promise that will be resolved or rejected with a response object.
1235
+ * See {@link ng.$http#$http-returns `$http()` return value}.
1217
1236
*/
1218
1237
createShortMethodsWithData ( 'post' , 'put' , 'patch' ) ;
1219
1238
0 commit comments