public static IRequestConfiguration WithJsonBody(this IRequestConfiguration configuration, object body, Formatting formatting, JsonSerializerSettings settings) { if (configuration == null) { throw new ArgumentNullException("configuration"); } return(configuration .ConfigureRequest(r => r.ContentType = ContentType) .WithBodyBuilder(new JsonBodyBuilder(body, formatting, settings))); }
public static IRequestConfiguration WithJsonBody(this IRequestConfiguration configuration, object body) { if (configuration == null) { throw new ArgumentNullException("configuration"); } return(configuration .ConfigureRequest(r => r.ContentType = ContentType) .WithBodyBuilder(new JsonBodyBuilder(body))); }
public static IRequestConfiguration WithUrlEncodedBody(this IRequestConfiguration configuration, object parameters) { if (configuration == null) { throw new ArgumentNullException("configuration"); } NameValueCollection collection = NameValueCollectionExtensions.CreateNameValueCollection(parameters); return(configuration .ConfigureRequest(r => r.ContentType = ContentType) .WithBodyBuilder(new UrlEncodedBodyBuilder(collection))); }
public static IRequestConfiguration WithUrlEncodedBody(this IRequestConfiguration configuration, Action <IUrlEncodedBodyBuilder> formBuilder) { if (configuration == null) { throw new ArgumentNullException("configuration"); } if (formBuilder == null) { throw new ArgumentNullException("formBuilder"); } return(configuration .ConfigureRequest(r => r.ContentType = ContentType) .WithBodyBuilder(new UrlEncodedBodyBuilder(formBuilder))); }
public static IRequestConfiguration WithUrlEncodedBody(this IRequestConfiguration configuration, NameValueCollection collection) { if (configuration == null) { throw new ArgumentNullException("configuration"); } if (collection == null) { throw new ArgumentNullException("collection"); } return(configuration .ConfigureRequest(r => r.ContentType = ContentType) .WithBodyBuilder(new UrlEncodedBodyBuilder(collection))); }
public static IRequestConfiguration WithMultiPartBody(this IRequestConfiguration configuration, Action <IMultiPartBodyBuilder> multiPartBuilder) { if (configuration == null) { throw new ArgumentNullException("configuration"); } if (multiPartBuilder == null) { throw new ArgumentNullException("multiPartBuilder"); } return(configuration .ConfigureRequest(r => r.ContentType = "multipart/form-data; boundary=" + MultiPartBodyBuilder.Boundary) .WithBodyBuilder(new MultiPartBodyBuilder(multiPartBuilder))); }