Add a way to set custom headers for the AJAX request.

This change is backwards compatible with the original code, and is
especially helpful for setting Authorization headers for OAuth services.