예제 #1
0
        public void AddUrlParameter(string key, string value)
        {
            CoreValidator.TrowIfNullOrEmpty(key, nameof(key));
            CoreValidator.TrowIfNullOrEmpty(value, nameof(value));

            this.UrlParameters[key] = value;
        }
예제 #2
0
        public RedirectResponse(string redirectUrl)
        {
            CoreValidator.TrowIfNullOrEmpty(redirectUrl, nameof(redirectUrl));

            this.StatusCode = HttpStatusCode.Found;
            this.Headers.Add(new HttpHeader("Location", redirectUrl));
        }
예제 #3
0
        public HttpHeader(string key, string value)
        {
            CoreValidator.TrowIfNullOrEmpty(key, nameof(key));
            CoreValidator.TrowIfNullOrEmpty(value, nameof(value));

            this.Key   = key;
            this.Value = value;
        }
예제 #4
0
        public HttpRequest(string requestText)
        {
            CoreValidator.TrowIfNullOrEmpty(requestText, nameof(requestText));

            this.FormData        = new Dictionary <string, string>();
            this.QueryParameters = new Dictionary <string, string>();
            this.UrlParameters   = new Dictionary <string, string>();
            this.Headers         = new HttpHeaderCollection();

            this.ParseRequest(requestText);
        }
        public HttpHeader Get(string key)
        {
            CoreValidator.TrowIfNullOrEmpty(key, nameof(key));

            if (!this.headers.ContainsKey(key))
            {
                throw new InvalidOperationException("The given key is not present in the headers collection.");
            }

            return(this.headers[key]);
        }
        public bool ContainsKey(string key)
        {
            CoreValidator.TrowIfNullOrEmpty(key, nameof(key));

            return(this.headers.ContainsKey(key));
        }