예제 #1
0
 /// <summary>
 /// Sets the specified header values without modification.
 /// </summary>
 /// <param name="key">The header name.</param>
 /// <param name="values">The header values.</param>
 public void SetValues(string key, params string[] values)
 {
     MiddlewareHelpers.SetHeaderUnmodified(Store, key, values);
 }
예제 #2
0
 /// <summary>
 /// Sets a 302 response status code and the Location header.
 /// </summary>
 /// <param name="location">The location where to redirect the client.</param>
 /// <param name="statusCode">302 status code by default, this param is for easy swap for 301s.</param>
 public virtual void Redirect(string location, int statusCode = 302)
 {
     StatusCode = statusCode;
     MiddlewareHelpers.SetHeader(RawHeaders, MiddlewareOwinConstants.Headers.Location, location);
 }
예제 #3
0
 /// <summary>
 /// Sets a specific header value.
 /// </summary>
 /// <param name="key">The header name.</param>
 /// <param name="value">The header value.</param>
 public void Set(string key, string value)
 {
     MiddlewareHelpers.SetHeader(Store, key, value);
 }
예제 #4
0
 /// <summary>
 /// Quotes any values containing comas, and then coma joins all of the values.
 /// </summary>
 /// <param name="key">The header name.</param>
 /// <param name="values">The header values.</param>
 public void SetCommaSeparatedValues(string key, params string[] values)
 {
     MiddlewareHelpers.SetHeaderJoined(Store, key, values);
 }
예제 #5
0
 /// <summary>
 /// Get the associated values from the collection without modification.
 /// </summary>
 /// <param name="key">The header name.</param>
 /// <returns>the associated value from the collection without modification, or null if the key is not present.</returns>
 public IList <string> GetValues(string key) => MiddlewareHelpers.GetHeaderUnmodified(Store, key);
예제 #6
0
        /// <summary>
        /// Get the associated values from the collection separated into individual values.
        /// Quoted values will not be split, and the quotes will be removed.
        /// </summary>
        /// <param name="key">The header name.</param>
        /// <returns>the associated values from the collection separated into individual values, or null if the key is not present.</returns>
        public IList <string> GetCommaSeparatedValues(string key)
        {
            IEnumerable <string> values = MiddlewareHelpers.GetHeaderSplit(Store, key);

            return(values is null ? null : values.ToList());
        }
예제 #7
0
 /// <summary>
 /// Get the associated value from the collection as a single string.
 /// </summary>
 /// <param name="key">The header name.</param>
 /// <returns>the associated value from the collection as a single string or null if the key is not present.</returns>
 public string Get(string key) => MiddlewareHelpers.GetHeader(Store, key);
예제 #8
0
 /// <summary>
 /// Add new values. Each item remains a separate array entry.
 /// </summary>
 /// <param name="key">The header name.</param>
 /// <param name="values">The header values.</param>
 public void AppendValues(string key, params string[] values)
 {
     MiddlewareHelpers.AppendHeaderUnmodified(Store, key, values);
 }
예제 #9
0
 /// <summary>
 /// Add a new value. Appends to the header if already present
 /// </summary>
 /// <param name="key">The header name.</param>
 /// <param name="value">The header value.</param>
 public void Append(string key, string value)
 {
     MiddlewareHelpers.AppendHeader(Store, key, value);
 }