Skip to content

Commit

Permalink
fix(http): default method to GET
Browse files Browse the repository at this point in the history
  • Loading branch information
pkozlowski-opensource committed Feb 21, 2014
1 parent 0c9abc3 commit 6af172a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ng/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ function $HttpProvider() {
*/
function $http(requestConfig) {
var config = {
method: 'get',
transformRequest: defaults.transformRequest,
transformResponse: defaults.transformResponse
};
Expand Down
10 changes: 10 additions & 0 deletions test/ng/httpSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,16 @@ describe('$http', function() {
expect(callback.mostRecentCall.args[0]).toBe('content');
}));

iit('should cache request when cache is provided and no method specified', function () {
doFirstCacheRequest();

$http({url: '/url', cache: cache}).success(callback);
$rootScope.$digest();

expect(callback).toHaveBeenCalledOnce();
expect(callback.mostRecentCall.args[0]).toBe('content');
});


it('should not cache when cache is not provided', function() {
doFirstCacheRequest();
Expand Down

0 comments on commit 6af172a

Please sign in to comment.