Skip to content

Commit

Permalink
add config & request to mock resp
Browse files Browse the repository at this point in the history
  • Loading branch information
eshengsky committed Dec 16, 2019
1 parent 02b20fb commit d69b9a0
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion content.js

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

3 changes: 3 additions & 0 deletions dist/axios-mocker-ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
if (mockResp.res.headers && _typeof(mockResp.res.headers) === 'object') {
Object.assign(resp.headers, mockResp.res.headers);
}
resp.config = config;
resp.request = null;
if (Number(mockResp.res.delay)) {
setTimeout(function () {
_this.mockDone(resp, config, resolve, reject, isCHN);
Expand All @@ -98,6 +100,7 @@
// 异常响应,自定义一个错误对象,和axios尽量一致
var customErr = new Error('Request failed with status code ' + resp.status);
customErr.response = resp;
customErr.request = null;
customErr.config = config;
reject(customErr);
}
Expand Down
Loading

0 comments on commit d69b9a0

Please sign in to comment.