Skip to content

Commit

Permalink
Add option to set withCredentials to true
Browse files Browse the repository at this point in the history
  • Loading branch information
stanley-cheung committed Jul 31, 2019
1 parent 2ae8118 commit 3657833
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions javascript/net/grpc/web/grpcwebclientbase.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};


Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 3657833

Please sign in to comment.