Added possibility to use xhr object with credentials:

When there's a need to pass information about credentials in headers (e.g. cookie), "withCredentials" needs to be set to "true" on the xhr object.