Exemple #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);
 }
 /// <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);
 }
Exemple #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);
 }
Exemple #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);
 }
Exemple #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);
Exemple #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());
        }
Exemple #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);
Exemple #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);
 }
Exemple #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);
 }