protected async void ButtonSend_Click(object sender, EventArgs e)
        {

            RequestOptions requestOptions = null;
 
            //Request response in JSON format            
            requestOptions = new RequestOptions();
            requestOptions.Headers.Add("Accept", "application/json");

            //Send Request
            var response = await Global.HelloServiceClient.GetAsync(Uri + TextBoxName.Text, requestOptions);

            //Display result
            PanelResponse.Visible = true;
            LabelResponse.Text = response.Content.ReadAsStringAsync().Result;

        }
示例#2
0
 public static void SetRequestOptions(HttpRequestMessage request, RequestOptions options)
 {
     request.Properties[REQUEST_OPTIONS_KEY] = options;
 }
示例#3
0
 private async static Task<System.Net.Http.HttpResponseMessage> SendMessage(RestBusClient client, RequestOptions requestOptions)
 {
     //Send Request
     var uri = "api/values"; //Substitute "hello/random" for the ServiceStack self-hosted example and "api/hello/random" for the ServiceStack ASP.Net hosted example
     return await client.GetAsync(uri, requestOptions);
 }
示例#4
0
 private static RabbitMQMessagingProperties GetMessagingProperties(RequestOptions options)
 {
     if (options == null) return _defaultMessagingProperties;
     return (options.Properties as RabbitMQMessagingProperties) ?? _defaultMessagingProperties;
 }
示例#5
0
        private TimeSpan GetRequestTimeout(RequestOptions options)
        {
            TimeSpan timeoutVal = this.Timeout;

            if (options != null && options.Timeout.HasValue)
            {
                timeoutVal = options.Timeout.Value;
            }

            return timeoutVal.Duration();
        }