Skip to content

Commit

Permalink
Expect HTTP method to be set through type, not method. Fixes #630.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Harding committed Feb 2, 2014
1 parent d5402b3 commit 94baabb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/bloodhound/options_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var oParser = (function() {
prefetch = _.mixin(defaults, prefetch);
prefetch.thumbprint = VERSION + prefetch.thumbprint;

prefetch.ajax.method = prefetch.ajax.method || 'get';
prefetch.ajax.type = prefetch.ajax.type || 'GET';
prefetch.ajax.dataType = prefetch.ajax.dataType || 'json';

!prefetch.url && $.error('prefetch requires url to be set');
Expand Down Expand Up @@ -65,7 +65,7 @@ var oParser = (function() {
remote.rateLimiter = /^throttle$/i.test(remote.rateLimitBy) ?
byThrottle(remote.rateLimitWait) : byDebounce(remote.rateLimitWait);

remote.ajax.method = remote.ajax.method || 'get';
remote.ajax.type = remote.ajax.type || 'GET';
remote.ajax.dataType = remote.ajax.dataType || 'json';

delete remote.rateLimitBy;
Expand Down
4 changes: 2 additions & 2 deletions test/bloodhound_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@ describe('Bloodhound', function() {

expect(this.bloodhound1.transport.get).toHaveBeenCalledWith(
'/test?q=one%20two',
{ method: 'get', dataType: 'json' },
{ type: 'GET', dataType: 'json' },
jasmine.any(Function)
);

expect(this.bloodhound2.transport.get).toHaveBeenCalledWith(
'/test?q=one two',
{ method: 'get', dataType: 'json' },
{ type: 'GET', dataType: 'json' },
jasmine.any(Function)
);
});
Expand Down

0 comments on commit 94baabb

Please sign in to comment.