public void AddParameter(string name, object parameter) { CoreValidator.ThrowIfNullOrEmty(name, nameof(name)); CoreValidator.ThrowIfNull(parameter, nameof(parameter)); this.parameters[name] = parameter; }
public Func <IHttpRequest, IHttpResponse> Get(HttpRequestMethod requestMethod, string path) { CoreValidator.ThrowIfNull(requestMethod, nameof(requestMethod)); CoreValidator.ThrowIfNullOrEmty(path, nameof(path)); return(this.routes[requestMethod][path]); }
public bool Contains(HttpRequestMethod requestMethod, string path) { CoreValidator.ThrowIfNull(requestMethod, nameof(requestMethod)); CoreValidator.ThrowIfNullOrEmty(path, nameof(path)); return(this.routes.ContainsKey(requestMethod) && this.routes[requestMethod].ContainsKey(path)); }
public HttpHeader(string key, string value) { CoreValidator.ThrowIfNullOrEmty(key, nameof(key)); CoreValidator.ThrowIfNullOrEmty(value, nameof(value)); this.Key = key; this.Value = value; }
public void Add(HttpRequestMethod method, string path, Func <IHttpRequest, IHttpResponse> func) { CoreValidator.ThrowIfNull(method, nameof(method)); CoreValidator.ThrowIfNullOrEmty(path, nameof(path)); CoreValidator.ThrowIfNull(func, nameof(func)); this.routes[method].Add(path, func); }
public HttpRequest(string requestString) { CoreValidator.ThrowIfNullOrEmty(requestString, nameof(requestString)); this.FormData = new Dictionary <string, object>(); this.QueryData = new Dictionary <string, object>(); this.Headers = new HttpHeaderCollection(); this.Cookies = new HttpCookieCollection(); this.ParseRequest(requestString); }
public HttpCookie(string key, string value, int expires = HttpCookieDefaultExpirationDays, string path = HttpCookieDefaultPath) { CoreValidator.ThrowIfNullOrEmty(key, nameof(key)); CoreValidator.ThrowIfNullOrEmty(value, nameof(value)); this.Key = key; this.Value = value; this.IsNew = true; this.Path = path; this.Expires = DateTime.UtcNow.AddDays(expires); }
public object GetParameter(string name) { CoreValidator.ThrowIfNullOrEmty(name, nameof(name)); return(this.parameters[name]); }
public bool ContainsParameter(string name) { CoreValidator.ThrowIfNullOrEmty(name, nameof(name)); return(this.parameters.ContainsKey(name)); }
public HttpHeader GetHeader(string key) { CoreValidator.ThrowIfNullOrEmty(key, nameof(key)); return(this.httpHeaders[key]); }
public bool ContainsHeader(string key) { CoreValidator.ThrowIfNullOrEmty(key, nameof(key)); return(this.httpHeaders.ContainsKey(key)); }
private bool IsValidRequestQueryString(string queryString, string[] queryParameters) { CoreValidator.ThrowIfNullOrEmty(queryString, nameof(queryString)); return(true);//TODO: RegEx querystring }
public HttpCookie GetCookie(string key) { CoreValidator.ThrowIfNullOrEmty(key, nameof(key)); return(this.httpCookies[key]); }
public bool ContainsCookie(string key) { CoreValidator.ThrowIfNullOrEmty(key, nameof(key)); return(this.httpCookies.ContainsKey(key)); }