public Response Include(Header header) { if (header != null && HeaderOf(header.Name) == null) { Headers.And(ResponseHeader.Of(header.Name, header.Value)); } return(this); }
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); }
/// <summary> /// Answer a <see cref="Response"/> with the <see cref="ResponseStatus"/> and <paramref name="entity"/> /// with a <code>Content-Type</code> header per my <code>ContentType</code>, which may be overridden. /// </summary> /// <param name="status">The status of the response</param> /// <param name="headers">The <see cref="Headers{ResponseHeader}"/> to which the <code>Content-Type</code> header is appended</param> /// <param name="entity">The string entity of the response</param> /// <returns><see cref="Response"/></returns> protected Response EntityResponseOf(ResponseStatus status, Headers <ResponseHeader> headers, string entity) => Response.Of(status, headers.And(ContentType.ToResponseHeader()), entity);