Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ and can contain a regex:
"uri": "/customer/\\d*/cart"
```

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this deserves its own section i.e.

Bypassing mocks

If you want to bypass mocks and issue a real http request, add an optional passThrough property to your mock.


```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
3 changes: 3 additions & 0 deletions app/src/js/multimocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ angular
}
return [200, mock.response, mockHeaders];
});
} if (mock.passThrough) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put the if on a new line:

}

if (....

$httpBackend.
when(mock.httpMethod, uriRegExp, mock.requestData).passThrough();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please indent this line 2 spaces.

} else {
$httpBackend
.when(mock.httpMethod, uriRegExp, mock.requestData)
Expand Down