kema

HttpHeader

Oct 18th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1. namespace MyCoolWebServer.Server.Http
  2. {
  3.     using MyCoolWebServer.Server.Common;
  4.  
  5.     public class HttpHeader
  6.     {
  7.         public const string ContentType = "Content-Type";
  8.         public const string Host = "Host";
  9.         public const string Location = "Location";
  10.         public const string Cookie = "Cookie";
  11.         public const string SetCookie = "Set-Cookie";
  12.  
  13.         public HttpHeader(string key, string value)
  14.         {
  15.             CoreValidator.ThrowIfNullOrEmpty(key, nameof(key));
  16.             CoreValidator.ThrowIfNullOrEmpty(value, nameof(value));
  17.  
  18.             this.Key = key;
  19.             this.Value = value;
  20.         }
  21.  
  22.         public string Key { get; private set; }
  23.  
  24.         public string Value { get; private set; }
  25.  
  26.         public override string ToString() => $"{this.Key}: {this.Value}";
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment