From 142ca602b4b86f74db267cee9bbc7ac709949712 Mon Sep 17 00:00:00 2001 From: Freek Wielstra Date: Wed, 14 May 2014 13:25:08 +0200 Subject: [PATCH] docs($http): clear up Interceptor docs and code The documentation and code example of $http interceptors is unclear about whether config can be null or not, and whether the result should always be a promise or not. This pr clears up the documentation a bit and removes the literal 'or a promise' interpretation of the docs in the code example. See #7431 --- src/ng/http.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ng/http.js b/src/ng/http.js index 61c7e8bae6cf..e9c283c90796 100644 --- a/src/ng/http.js +++ b/src/ng/http.js @@ -328,14 +328,14 @@ function $HttpProvider() { * * There are two kinds of interceptors (and two kinds of rejection interceptors): * - * * `request`: interceptors get called with http `config` object. The function is free to - * modify the `config` or create a new one. The function needs to return the `config` - * directly or as a promise. + * * `request`: interceptors get called with a http `config` object. The function is free to + * modify the `config` object or create a new one. The function needs to return the `config` + * object directly, or a promise containing the `config` or a new `config` object. * * `requestError`: interceptor gets called when a previous interceptor threw an error or * resolved with a rejection. * * `response`: interceptors get called with http `response` object. The function is free to - * modify the `response` or create a new one. The function needs to return the `response` - * directly or as a promise. + * modify the `response` object or create a new one. The function needs to return the `response` + * object directly, or as a promise containing the `response` or a new `response` object. * * `responseError`: interceptor gets called when a previous interceptor threw an error or * resolved with a rejection. * @@ -347,7 +347,7 @@ function $HttpProvider() { * // optional method * 'request': function(config) { * // do something on success - * return config || $q.when(config); + * return config; * }, * * // optional method @@ -364,7 +364,7 @@ function $HttpProvider() { * // optional method * 'response': function(response) { * // do something on success - * return response || $q.when(response); + * return response; * }, * * // optional method