Created
March 8, 2016 12:02
-
-
Save smorcuend/82eae3b50e5e896c81c3 to your computer and use it in GitHub Desktop.
Angular2 feat(http): add support for withCredentials
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {BrowserXhr, HTTP_PROVIDERS} from "angular2/http"; | |
import {Injectable, provide} from "angular2/core"; | |
@Injectable() | |
class CORSBrowserXHR extends BrowserXhr{ | |
build(): any{ | |
var xhr:any = super.build(); | |
xhr.withCredentials = true; | |
return xhr; | |
} | |
} | |
//... | |
//In your bootstrapped providers: | |
HTTP_PROVIDERS, | |
provide(BrowserXhr, {useClass: CORSBrowserXHR}), | |
//... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment