Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,19 @@ and can contain a regex:
"uri": "/customer/\\d*/cart"
```

### Bypassing mocks

To use the option of bypass the mock and issue real http request, the resource files should look like this:

```json
{
"httpMethod": "GET",
"statusCode": 200,
"uri": "/customer/cart",
"passThrough": true
}
```

### Delayed responses

In some scenarios you may want to simulate a server/network delay.
Expand Down
5 changes: 5 additions & 0 deletions app/package/js/angular-multimocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ angular
}
return [200, mock.response, mockHeaders];
});
}
if (mock.passThrough) {
$httpBackend
.when(mock.httpMethod, uriRegExp, mock.requestData)
.passThrough();
} else {
$httpBackend
.when(mock.httpMethod, uriRegExp, mock.requestData)
Expand Down
2 changes: 1 addition & 1 deletion app/package/js/angular-multimocks.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions app/src/js/multimocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ angular
}
return [200, mock.response, mockHeaders];
});
}
if (mock.passThrough) {
$httpBackend
.when(mock.httpMethod, uriRegExp, mock.requestData)
.passThrough();
} else {
$httpBackend
.when(mock.httpMethod, uriRegExp, mock.requestData)
Expand Down