Beispiel #1
0
 public Response Include(Header header)
 {
     if (header != null && HeaderOf(header.Name) == null)
     {
         Headers.And(ResponseHeader.Of(header.Name, header.Value));
     }
     return(this);
 }
Beispiel #2
0
        public Headers <T> Copy()
        {
            var headers = new Headers <T>(_list.Count);
            var array   = new T[_list.Count];

            _list.CopyTo(array);

            foreach (var header in array)
            {
                headers.And(header);
            }

            return(headers);
        }
Beispiel #3
0
        internal Request(Method method, Uri uri, Version version, Headers <RequestHeader> headers, Body body)
        {
            Method  = method;
            Uri     = uri;
            Version = version;
            Body    = body;

            if (body != null && body.HasContent && headers.HeaderOf("Content-Length") == null)
            {
                Headers = headers.And("Content-Length", $"{body.Content.Length}");
            }
            else
            {
                Headers = headers;
            }
        }