Pre-flight OPTIONS request to API results in exception


Playing around with writing a web app that utilises the (awesome) Warcraft Logs API. Unfortunately, as it is a cross-origin request, the browser’s security kicks in and does a pre-flight OPTIONS request before the GET request, and this OPTIONS request (despite returning a 200 success status code) seems to be failing.

You can recreate by using Postman or something similar to make an OPTIONS request to:

The response is:

<html><h2>Unhandled Exception</h2>
<pre>Call to a member function call() on null</pre>
<pre>/var/app/current/laravel/laravel.php on line 165</pre>


If anyone else has this problem, you might be able to get around it by removing any custom headers in your GET request (for example, Angular was setting a couple of headers by default when using the Http module, so I passed in a blank Headers object to counteract this).

Ideally, the API would be configured to accept OPTIONS requests, but I can see why it might be a low priority thing.