private static HttpCall CreateCall(HttpCallMethodType type, object body) { return(new HttpCall( "https://www.google.ch/", type, new BasicAuthCredentials(Guid.NewGuid().ToString(), Guid.NewGuid().ToString()), body)); }
public HttpCall( string requestUri, HttpCallMethodType methodType, BasicAuthCredentials credentials, object body = null) { Guard.StringNotNullOrEmpty(() => requestUri); Guard.That(() => body == null || methodType != HttpCallMethodType.Get, "Body in GET request is not allowed"); RequestUri = requestUri; MethodType = methodType; Credentials = credentials; Body = body; }
private static HttpMethod MapHttpMethod(HttpCallMethodType methodType) { switch (methodType) { case HttpCallMethodType.Get: return(HttpMethod.Get); case HttpCallMethodType.Post: return(HttpMethod.Post); case HttpCallMethodType.Patch: return(new HttpMethod("PATCH")); case HttpCallMethodType.Delete: return(HttpMethod.Delete); case HttpCallMethodType.Put: return(HttpMethod.Put); default: throw new ArgumentException($"Invalid RestCallMethodType{methodType}."); } }