bloodhound icon indicating copy to clipboard operation
bloodhound copied to clipboard

Custom AJAX settings not being used

Open u01jmg3 opened this issue 8 years ago • 0 comments

  • 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.

u01jmg3 avatar Dec 15 '16 11:12 u01jmg3