public HttpPostRequest(string address, IHttpHeadersCollection headers, IPostContent postContent, TimeSpan?timeout = null, bool allowRedirects = true) : base(address, headers, timeout, allowRedirects) { Contract.Requires <ArgumentNullException>(postContent != null); _postContent = postContent; }
private HttpContent GetHttpContent(IPostContent postContent) { if (postContent.GetType() == typeof(StringPostContent)) { var stringPostContent = (StringPostContent)postContent; return(new StringContent(stringPostContent.Data, stringPostContent.Encoding, stringPostContent.MediaType)); } if (postContent.GetType() == typeof(FormUrlEncodedPostContent)) { return(new FormUrlEncodedContent(((FormUrlEncodedPostContent)postContent).Data)); } throw new NotSupportedException(String.Format("Unknown post content type: {0}", postContent.GetType())); }
public void On(IPostContent postContent) => PostContent.Execute(postContent);