/// <summary> /// An <see cref="IWire"/> implemented using ASP.NET Core. /// </summary> public AspNetCoreWire(IAspHttpClients clients, TimeSpan timeout) { this.clients = clients; this.timeout = timeout; this.methods = new MapOf <HttpMethod>( new KeyValuePair <string, HttpMethod>("delete", HttpMethod.Delete), new KeyValuePair <string, HttpMethod>("get", HttpMethod.Get), new KeyValuePair <string, HttpMethod>("head", HttpMethod.Head), new KeyValuePair <string, HttpMethod>("options", HttpMethod.Options), new KeyValuePair <string, HttpMethod>("post", HttpMethod.Post), new KeyValuePair <string, HttpMethod>("put", HttpMethod.Put), new KeyValuePair <string, HttpMethod>("trace", HttpMethod.Trace) ); this.requestVerification = new Verifications.Joined( new Verifications.Verification( req => new Address.Exists(req).Value(), req => new ArgumentException("No target URI has been specified for the request.") ), new Verifications.Verification( req => new Method.Exists(req).Value(), req => new ArgumentException("No http Method has been specified for the request.") ), new Verifications.Verification( req => this.methods.ContainsKey(new Method.Of(req).AsString()), req => new ArgumentException( new Formatted( "Unknown method '{0}'. Known methods are {1}", new Method.Of(req).AsString(), new Yaapii.Atoms.Text.Joined(", ", this.methods.Keys ).AsString() ).AsString() ) ) ); }
/// <summary> /// An <see cref="IWire"/> implemented using ASP.NET Core. /// Timeout is 1 minute. /// </summary> public AspNetCoreWire(IAspHttpClients clients) : this(clients, new TimeSpan(0, 1, 0)) { }