From 4ec1d8ee86e3138fb91543ca0dca28463895c090 Mon Sep 17 00:00:00 2001 From: Karl Seamon Date: Fri, 29 Jul 2011 18:32:30 -0400 Subject: feat($xhr,$resource): expose response headers in callbacks all $xhr*, $resource and related mocks now have access to headers from their callbacks --- src/Browser.js | 35 +++++++++++++++++++++++++++++++++-- src/Resource.js | 4 ++-- src/angular-mocks.js | 35 ++++++++++++++++++++++++++--------- src/service/resource.js | 10 ++++++++-- src/service/xhr.bulk.js | 11 ++++++----- src/service/xhr.cache.js | 18 +++++++++--------- src/service/xhr.js | 11 +++++++---- 7 files changed, 91 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/Browser.js b/src/Browser.js index 2b2170e2..65d27448 100644 --- a/src/Browser.js +++ b/src/Browser.js @@ -84,7 +84,9 @@ function Browser(window, document, body, XHR, $log) { * @param {string} method Requested method (get|post|put|delete|head|json) * @param {string} url Requested url * @param {?string} post Post data to send (null if nothing to post) - * @param {function(number, string)} callback Function that will be called on response + * @param {function(number, string, function([string]))} callback Function that will be called on + * response. The third argument is a function that can be called to return a specified response + * header or an Object containing all headers (when called with no arguments). * @param {object=} header additional HTTP headers to send with XHR. * Standard headers are: *