/// <summary> /// Prepares the request by adding two headers to it /// </summary> public void PrepareRequest(BestHTTP.HTTPRequest request) { if (this._connection.NegotiationResult == null) { return; } #if !UNITY_WEBGL || UNITY_EDITOR // Add Authorization header to http requests, add access_token param to the uri otherwise if (BestHTTP.Connections.HTTPProtocolFactory.GetProtocolFromUri(request.CurrentUri) == BestHTTP.Connections.SupportedProtocols.HTTP) { request.SetHeader("Authorization", "Bearer " + this._connection.NegotiationResult.AccessToken); } else #endif if (BestHTTP.Connections.HTTPProtocolFactory.GetProtocolFromUri(request.Uri) != BestHTTP.Connections.SupportedProtocols.WebSocket) { request.Uri = PrepareUriImpl(request.Uri); } }
static StackObject *SetHeader_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.String @value = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.String @name = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); BestHTTP.HTTPRequest instance_of_this_method = (BestHTTP.HTTPRequest) typeof(BestHTTP.HTTPRequest).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 0); __intp.Free(ptr_of_this_method); instance_of_this_method.SetHeader(@name, @value); return(__ret); }
/// <summary> /// Prepares the request by adding two headers to it /// </summary> public void PrepareRequest(BestHTTP.HTTPRequest request) { #if !UNITY_WEBGL request.SetHeader("Authorization", "Basic " + this._credentials); #endif }
/// <summary> /// Prepares the request by adding two headers to it /// </summary> public void PrepareRequest(BestHTTP.HTTPRequest request, RequestTypes type) { request.SetHeader("username", this.User); request.SetHeader("roles", this.Roles); }