/// <summary> /// Initializes a new instance of the <see cref="FluentHttpAsyncResult"/> class. /// </summary> /// <param name="request">The <see cref="FluentHttpRequest"/>.</param> /// <param name="response">The <see cref="FluentHttpResponse"/>.</param> /// <param name="asyncState">The async state.</param> /// <param name="asyncWaitHandle">The async wait handle.</param> /// <param name="completedSynchronously">Indicates whether the async operation completed synchronously.</param> /// <param name="isCompleted">Indicates whether the async operation completed.</param> /// <param name="isCancelled">Indicates whether the async operation was cancelled.</param> /// <param name="exception">The exception during the http web request.</param> /// <param name="innerException">The inner exception during the http web request.</param> public FluentHttpAsyncResult(FluentHttpRequest request, FluentHttpResponse response, object asyncState, WaitHandle asyncWaitHandle, bool completedSynchronously, bool isCompleted, bool isCancelled, Exception exception, Exception innerException) { _request = request; _response = response; _asyncState = asyncState; _asyncWaitHandle = asyncWaitHandle; _completedSynchronously = completedSynchronously; _isCompleted = isCompleted; _isCancelled = isCancelled; _exception = exception; _innerException = innerException; }
/// <summary> /// Initializes a new instance of the <see cref="FluentQueryString"/> class. /// </summary> /// <param name="name"> /// The query string name. /// </param> /// <param name="value"> /// The query string value. /// </param> /// <param name="encode"> /// Indicates whether to encode the querystring name and value. /// </param> public FluentQueryString(string name, string value, bool encode) { if (encode) { this.Name = FluentHttpRequest.UrlEncode(name); this.Value = FluentHttpRequest.UrlEncode(value); } else { this.Name = name; this.Value = value; } }
/// <summary> /// Appends the form parameters. /// </summary> /// <param name="parameters"> /// The parameters. /// </param> /// <returns> /// The fluent http request body. /// </returns> public FluentHttpRequestBody Append(IDictionary <string, object> parameters) { if (parameters == null || parameters.Count == 0) { return(this); } var sb = new StringBuilder(); foreach (var parameter in parameters) { sb.AppendFormat("{0}={1}&", FluentHttpRequest.UrlEncode(parameter.Key), FluentHttpRequest.UrlEncode(parameter.Value.ToString())); } // remove the last & --sb.Length; return(Append(sb.ToString())); }
/// <summary> /// Initializes a new instance of the <see cref="FluentHttpRequestBody"/> class. /// </summary> public FluentHttpRequestBody(FluentHttpRequest request) { _request = request; _streams = new List <Stream>(); }
/// <summary> /// Initializes a new instance of the <see cref="FluentHttpResponse"/> class. /// </summary> /// <param name="request"> /// The fluent http web request. /// </param> /// <param name="httpWebResponse"> /// The http web response. /// </param> public FluentHttpResponse(FluentHttpRequest request, IHttpWebResponse httpWebResponse) : this() { _request = request; _httpWebResponse = httpWebResponse; }