Skip to content

Commit

Permalink
Check for functions with typeof.
Browse files Browse the repository at this point in the history
Fixes #132
  • Loading branch information
ctimmerm committed Jun 20, 2018
1 parent 4a0e874 commit 0901797
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/handle_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function handleRequest(mockAdapter, resolve, reject, config) {
// tell axios to use the original adapter instead of our mock, fixes #35
config.adapter = mockAdapter.originalAdapter;
mockAdapter.axiosInstance.request(config).then(resolve, reject);
} else if (!(handler[3] instanceof Function)) {
} else if (typeof handler[3] !== 'function') {
utils.settle(
resolve,
reject,
Expand All @@ -50,7 +50,7 @@ function handleRequest(mockAdapter, resolve, reject, config) {
} else {
var result = handler[3](config);
// TODO throw a sane exception when return value is incorrect
if (!(result.then instanceof Function)) {
if (typeof result.then !== 'function') {
utils.settle(resolve, reject, makeResponse(result, config), mockAdapter.delayResponse);
} else {
result.then(
Expand Down

0 comments on commit 0901797

Please # to comment.