/* * Copyright (c) 2022 Vaughn Nugent * * Library: VNLib * Package: VNLib.Net.Http * File: IHeaderCollection.cs * * IHeaderCollection.cs is part of VNLib.Net.Http which is part of the larger * VNLib collection of libraries and utilities. * * VNLib.Net.Http is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * VNLib.Net.Http is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. */ using System.Net; using System.Collections.Generic; namespace VNLib.Net.Http { /// /// The container for request and response headers /// public interface IHeaderCollection { /// /// Allows for enumeratring all requesest headers /// IEnumerable> RequestHeaders { get; } /// /// Allows for enumeratring all response headers /// IEnumerable> ResponseHeaders { get; } /// /// Gets request header, or sets a response header /// /// /// Request header with key string? this[string index] { get; set; } /// /// Sets a response header only with a response header index /// /// Response header string this[HttpResponseHeader index] { set; } /// /// Gets a request header /// /// The request header enum string? this[HttpRequestHeader index] { get; } /// /// Determines if the given header is set in current response headers /// /// Header value to check response headers for /// true if header exists in current response headers, false otherwise bool HeaderSet(HttpResponseHeader header); /// /// Determines if the given request header is set in current request headers /// /// Header value to check request headers for /// true if header exists in current request headers, false otherwise bool HeaderSet(HttpRequestHeader header); /// /// Appends the header value to the current header value /// /// The enumrated header id /// The value to specify void Append(HttpResponseHeader header, string? value); /// /// Appends the header value to the current header value /// /// The header name /// The value to specify void Append(string header, string? value); } }