Add option to set withCredentials to true

This commit is contained in:
Stanley Cheung 2019-07-31 16:23:18 -07:00 committed by Stanley Cheung
parent 2ae8118d78
commit 365783307e
1 changed files with 10 additions and 0 deletions

View File

@ -56,6 +56,14 @@ const GrpcWebClientBase = function(opt_options) {
*/
this.suppressCorsPreflight_ =
goog.getObjectByName('suppressCorsPreflight', opt_options) || false;
/**
* @const
* @private {boolean}
*/
this.withCredentials_ =
goog.getObjectByName('withCredentials', opt_options) || false;
};
@ -66,6 +74,7 @@ const GrpcWebClientBase = function(opt_options) {
GrpcWebClientBase.prototype.rpcCall = function(
method, request, metadata, methodInfo, callback) {
var xhr = this.newXhr_();
xhr.setWithCredentials(this.withCredentials_);
var genericTransportInterface = {
xhr: xhr,
@ -136,6 +145,7 @@ GrpcWebClientBase.prototype.unaryCall = function(
GrpcWebClientBase.prototype.serverStreaming = function(
method, request, metadata, methodInfo) {
var xhr = this.newXhr_();
xhr.setWithCredentials(this.withCredentials_);
var genericTransportInterface = {
xhr: xhr,