Added error callbacks and custom headers for Basic Auth

Added parameters for errorCallback and customHeaders. errorCallback will be called if the request fails (status code 400 or above). customHeaders is an object that has a key-value system that can be inject to the request
headers before sending off the request - beneficial for things like Basic Authorization.

All the changes are backward compatible - the ordering of the parameters are a bit awkward so that they can be compatible with current implementations of JIC.