Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 61cb408

Browse files
santialboIgorMinar
authored andcommitted
docs(httpBackend): update documentation for expect methods
`expect` methods can receive an Object as the data parameter, which was undocumented.
1 parent 0c399bc commit 61cb408

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/ngMock/angular-mocks.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -1246,8 +1246,9 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
12461246
*
12471247
* @param {string} method HTTP method.
12481248
* @param {string|RegExp} url HTTP url.
1249-
* @param {(string|RegExp|function(string))=} data HTTP request body or function that receives
1250-
* data string and returns true if the data is as expected.
1249+
* @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
1250+
* receives data string and returns true if the data is as expected, or Object if request body
1251+
* is in JSON format.
12511252
* @param {(Object|function(Object))=} headers HTTP headers or function that receives http header
12521253
* object and returns true if the headers match the current expectation.
12531254
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
@@ -1316,8 +1317,9 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
13161317
* Creates a new request expectation for POST requests. For more info see `expect()`.
13171318
*
13181319
* @param {string|RegExp} url HTTP url.
1319-
* @param {(string|RegExp|function(string))=} data HTTP request body or function that receives
1320-
* data string and returns true if the data is as expected.
1320+
* @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
1321+
* receives data string and returns true if the data is as expected, or Object if request body
1322+
* is in JSON format.
13211323
* @param {Object=} headers HTTP headers.
13221324
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
13231325
* request is handled.
@@ -1331,8 +1333,9 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
13311333
* Creates a new request expectation for PUT requests. For more info see `expect()`.
13321334
*
13331335
* @param {string|RegExp} url HTTP url.
1334-
* @param {(string|RegExp|function(string))=} data HTTP request body or function that receives
1335-
* data string and returns true if the data is as expected.
1336+
* @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
1337+
* receives data string and returns true if the data is as expected, or Object if request body
1338+
* is in JSON format.
13361339
* @param {Object=} headers HTTP headers.
13371340
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
13381341
* request is handled.
@@ -1346,8 +1349,9 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
13461349
* Creates a new request expectation for PATCH requests. For more info see `expect()`.
13471350
*
13481351
* @param {string|RegExp} url HTTP url.
1349-
* @param {(string|RegExp|function(string))=} data HTTP request body or function that receives
1350-
* data string and returns true if the data is as expected.
1352+
* @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
1353+
* receives data string and returns true if the data is as expected, or Object if request body
1354+
* is in JSON format.
13511355
* @param {Object=} headers HTTP headers.
13521356
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
13531357
* request is handled.

0 commit comments

Comments
 (0)