bloodhound
bloodhound copied to clipboard
Custom AJAX settings not being used
- I use this library along with typeahead in a Laravel application.
- In order to get things to work correctly with Laravel's auth API logic, you must send an accept header of "application/json".
- I believe you should be able to set this in Bloodhound as a prepare function but looking at ajax.js none of those settings are ever used when sending the request apart from the URL (
o.url). - Instead could the request logic be amended to include the correct accept header?
request.get(o.url).set('Accept', 'application/json').end(function(err, res) {
if(err) return reject(err);
resolve(res.body);
});
--
- Realistically though, you should be able to set any AJAX setting.