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

Commit 6da835f

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 5cca077 commit 6da835f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/ngMock/angular-mocks.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,9 @@ function createHttpBackendMock($delegate, $browser) {
10881088
*
10891089
* @param {string} method HTTP method.
10901090
* @param {string|RegExp} url HTTP url.
1091-
* @param {(string|RegExp)=} data HTTP request body.
1091+
* @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
1092+
* receives data string and returns true if the data is as expected, or Object if request body
1093+
* is in JSON format.
10921094
* @param {(Object|function(Object))=} headers HTTP headers or function that receives http header
10931095
* object and returns true if the headers match the current expectation.
10941096
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
@@ -1157,7 +1159,9 @@ function createHttpBackendMock($delegate, $browser) {
11571159
* Creates a new request expectation for POST requests. For more info see `expect()`.
11581160
*
11591161
* @param {string|RegExp} url HTTP url.
1160-
* @param {(string|RegExp)=} data HTTP request body.
1162+
* @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
1163+
* receives data string and returns true if the data is as expected, or Object if request body
1164+
* is in JSON format.
11611165
* @param {Object=} headers HTTP headers.
11621166
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
11631167
* request is handled.
@@ -1171,7 +1175,9 @@ function createHttpBackendMock($delegate, $browser) {
11711175
* Creates a new request expectation for PUT requests. For more info see `expect()`.
11721176
*
11731177
* @param {string|RegExp} url HTTP url.
1174-
* @param {(string|RegExp)=} data HTTP request body.
1178+
* @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
1179+
* receives data string and returns true if the data is as expected, or Object if request body
1180+
* is in JSON format.
11751181
* @param {Object=} headers HTTP headers.
11761182
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
11771183
* request is handled.
@@ -1185,7 +1191,9 @@ function createHttpBackendMock($delegate, $browser) {
11851191
* Creates a new request expectation for PATCH requests. For more info see `expect()`.
11861192
*
11871193
* @param {string|RegExp} url HTTP url.
1188-
* @param {(string|RegExp)=} data HTTP request body.
1194+
* @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
1195+
* receives data string and returns true if the data is as expected, or Object if request body
1196+
* is in JSON format.
11891197
* @param {Object=} headers HTTP headers.
11901198
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
11911199
* request is handled.

0 commit comments

Comments
 (0)