Beispiel #1
0
 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));
 }
Beispiel #2
0
 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));
 }
Beispiel #3
0
 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));
 }