Skip to content

Commit

Permalink
Merge pull request #6 from jDeppen/master
Browse files Browse the repository at this point in the history
GET vs get - Accept method in any case when passing the relevant config to axios.
  • Loading branch information
ctimmerm committed May 25, 2016
2 parents 63721f8 + ee763ba commit 913ae94
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var verbs = ['get', 'post', 'head', 'delete', 'patch', 'put'];

function findHandler(matchers, method, url) {
return matchers[method].find(function(matcher) {
return matchers[method.toLowerCase()].find(function(matcher) {
if (typeof matcher[0] === 'string') {
return url === matcher[0];
} else if (matcher[0] instanceof RegExp) {
Expand Down
15 changes: 15 additions & 0 deletions test/mock_adapter_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,21 @@ describe('MockAdapter', function() {
done();
});
});

it('mocks requests on the default instance when method CAPS', function(done) {
var defaultMock = new MockAdapter(axios);

defaultMock.onGet('/foo').reply(200);

axios({
method: 'GET',
url: '/foo'
})
.then(function(response) {
expect(response.status).to.equal(200);
done();
});
});
});

context('.onAny', function() {
Expand Down

0 comments on commit 913ae94

Please sign in to comment.