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; }
public static void SetRequestOptions(HttpRequestMessage request, RequestOptions options) { request.Properties[REQUEST_OPTIONS_KEY] = options; }
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); }
private static RabbitMQMessagingProperties GetMessagingProperties(RequestOptions options) { if (options == null) return _defaultMessagingProperties; return (options.Properties as RabbitMQMessagingProperties) ?? _defaultMessagingProperties; }
private TimeSpan GetRequestTimeout(RequestOptions options) { TimeSpan timeoutVal = this.Timeout; if (options != null && options.Timeout.HasValue) { timeoutVal = options.Timeout.Value; } return timeoutVal.Duration(); }