Angular 2 Http request does not send credentials

前端 未结 1 1298
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-13 03:49

I am working with Angular 2 and I am trying to send HTTP request with credentials:

This Angular 1 code works well, it includes the credentials:

$http         


        
1条回答
  •  抹茶落季
    2021-01-13 04:29

    I'm using angular2@2.0.0-alpha.37;

    If you add code in xhr_backed.js, You can send 'credentials' to server

    this._xhr.withCredentials = true;
    

    angular2@2.0.0-alpha.37/src/http/backends/xhr_backed.js

    var XHRConnection = (function() {
      function XHRConnection(req, browserXHR, baseResponseOptions) {
        ........
        this._xhr = browserXHR.build();
        this._xhr.withCredentials = true;
        ........
    

    :)

    0 讨论(0)
提交回复
热议问题