This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix($http): add missing shortcut methods and missing docs #9321
Closed
gkalpak
wants to merge
1
commit into
angular:v1.2.x
from
gkalpak:add-missing-shortcut-methods-and-docs-to-$http-v1.2.25
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1186,7 +1186,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { | |
* data string and returns true if the data is as expected. | ||
* @param {(Object|function(Object))=} headers HTTP headers or function that receives http header | ||
* object and returns true if the headers match the current definition. | ||
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched | ||
* @returns {requestHandler} Returns an object with a `respond` method that controlss how a matched | ||
* request is handled. | ||
* | ||
* - respond – | ||
|
@@ -1222,7 +1222,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { | |
* | ||
* @param {string|RegExp} url HTTP url. | ||
* @param {(Object|function(Object))=} headers HTTP headers. | ||
* @returns {requestHandler} Returns an object with `respond` method that control how a matched | ||
* @returns {requestHandler} Returns an object with a `respond` method that controls how a matched | ||
* request is handled. | ||
*/ | ||
|
||
|
@@ -1234,7 +1234,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { | |
* | ||
* @param {string|RegExp} url HTTP url. | ||
* @param {(Object|function(Object))=} headers HTTP headers. | ||
* @returns {requestHandler} Returns an object with `respond` method that control how a matched | ||
* @returns {requestHandler} Returns an object with a `respond` method that controls how a matched | ||
* request is handled. | ||
*/ | ||
|
||
|
@@ -1246,7 +1246,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { | |
* | ||
* @param {string|RegExp} url HTTP url. | ||
* @param {(Object|function(Object))=} headers HTTP headers. | ||
* @returns {requestHandler} Returns an object with `respond` method that control how a matched | ||
* @returns {requestHandler} Returns an object with a `respond` method that controls how a matched | ||
* request is handled. | ||
*/ | ||
|
||
|
@@ -1260,7 +1260,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { | |
* @param {(string|RegExp|function(string))=} data HTTP request body or function that receives | ||
* data string and returns true if the data is as expected. | ||
* @param {(Object|function(Object))=} headers HTTP headers. | ||
* @returns {requestHandler} Returns an object with `respond` method that control how a matched | ||
* @returns {requestHandler} Returns an object with a `respond` method that controls how a matched | ||
* request is handled. | ||
*/ | ||
|
||
|
@@ -1274,7 +1274,21 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { | |
* @param {(string|RegExp|function(string))=} data HTTP request body or function that receives | ||
* data string and returns true if the data is as expected. | ||
* @param {(Object|function(Object))=} headers HTTP headers. | ||
* @returns {requestHandler} Returns an object with `respond` method that control how a matched | ||
* @returns {requestHandler} Returns an object with a `respond` method that controls how a matched | ||
* request is handled. | ||
*/ | ||
|
||
/** | ||
* @ngdoc method | ||
* @name $httpBackend#whenPATCH | ||
* @description | ||
* Creates a new backend definition for PATCH requests. For more info see `when()`. | ||
* | ||
* @param {string|RegExp} url HTTP url. | ||
* @param {(string|RegExp|function(string))=} data HTTP request body or function that receives | ||
* data string and returns true if the data is as expected. | ||
* @param {(Object|function(Object))=} headers HTTP headers. | ||
* @returns {requestHandler} Returns an object with a `respond` method that controls how a matched | ||
* request is handled. | ||
*/ | ||
|
||
|
@@ -1285,7 +1299,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { | |
* Creates a new backend definition for JSONP requests. For more info see `when()`. | ||
* | ||
* @param {string|RegExp} url HTTP url. | ||
* @returns {requestHandler} Returns an object with `respond` method that control how a matched | ||
* @returns {requestHandler} Returns an object with a `respond` method that controls how a matched | ||
* request is handled. | ||
*/ | ||
createShortMethods('when'); | ||
|
@@ -1304,7 +1318,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { | |
* is in JSON format. | ||
* @param {(Object|function(Object))=} headers HTTP headers or function that receives http header | ||
* object and returns true if the headers match the current expectation. | ||
* @returns {requestHandler} Returns an object with `respond` method that control how a matched | ||
* @returns {requestHandler} Returns an object with a `respond` method that controls how a matched | ||
* request is handled. | ||
* | ||
* - respond – | ||
|
@@ -1333,7 +1347,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { | |
* | ||
* @param {string|RegExp} url HTTP url. | ||
* @param {Object=} headers HTTP headers. | ||
* @returns {requestHandler} Returns an object with `respond` method that control how a matched | ||
* @returns {requestHandler} Returns an object with a `respond` method that controls how a matched | ||
* request is handled. See #expect for more info. | ||
*/ | ||
|
||
|
@@ -1345,7 +1359,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { | |
* | ||
* @param {string|RegExp} url HTTP url. | ||
* @param {Object=} headers HTTP headers. | ||
* @returns {requestHandler} Returns an object with `respond` method that control how a matched | ||
* @returns {requestHandler} Returns an object with a `respond` method that controls how a matched | ||
* request is handled. | ||
*/ | ||
|
||
|
@@ -1357,7 +1371,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { | |
* | ||
* @param {string|RegExp} url HTTP url. | ||
* @param {Object=} headers HTTP headers. | ||
* @returns {requestHandler} Returns an object with `respond` method that control how a matched | ||
* @returns {requestHandler} Returns an object with a `respond` method that controls how a matched | ||
* request is handled. | ||
*/ | ||
|
||
|
@@ -1372,7 +1386,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { | |
* receives data string and returns true if the data is as expected, or Object if request body | ||
* is in JSON format. | ||
* @param {Object=} headers HTTP headers. | ||
* @returns {requestHandler} Returns an object with `respond` method that control how a matched | ||
* @returns {requestHandler} Returns an object with a `respond` method that controls how a matched | ||
* request is handled. | ||
*/ | ||
|
||
|
@@ -1387,7 +1401,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { | |
* receives data string and returns true if the data is as expected, or Object if request body | ||
* is in JSON format. | ||
* @param {Object=} headers HTTP headers. | ||
* @returns {requestHandler} Returns an object with `respond` method that control how a matched | ||
* @returns {requestHandler} Returns an object with a `respond` method that controls how a matched | ||
* request is handled. | ||
*/ | ||
|
||
|
@@ -1402,7 +1416,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { | |
* receives data string and returns true if the data is as expected, or Object if request body | ||
* is in JSON format. | ||
* @param {Object=} headers HTTP headers. | ||
* @returns {requestHandler} Returns an object with `respond` method that control how a matched | ||
* @returns {requestHandler} Returns an object with a `respond` method that controls how a matched | ||
* request is handled. | ||
*/ | ||
|
||
|
@@ -1413,7 +1427,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { | |
* Creates a new request expectation for JSONP requests. For more info see `expect()`. | ||
* | ||
* @param {string|RegExp} url HTTP url. | ||
* @returns {requestHandler} Returns an object with `respond` method that control how a matched | ||
* @returns {requestHandler} Returns an object with a `respond` method that controls how a matched | ||
* request is handled. | ||
*/ | ||
createShortMethods('expect'); | ||
|
@@ -1506,7 +1520,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { | |
|
||
|
||
function createShortMethods(prefix) { | ||
angular.forEach(['GET', 'DELETE', 'JSONP'], function(method) { | ||
angular.forEach(['GET', 'DELETE', 'JSONP', 'HEAD'], function(method) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we should add in the HEAD method to 1.2.x There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @petebacondarwin : HEAD is already there. This is just adding the mock. |
||
$httpBackend[prefix + method] = function(url, headers) { | ||
return $httpBackend[prefix](method, url, undefined, headers); | ||
}; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
controlss !