| | | 1 | | using System.Net.Http.Headers; |
| | | 2 | | using System.Text.Json.Serialization; |
| | | 3 | | using Elsa.Extensions; |
| | | 4 | | using Elsa.Http.Serialization; |
| | | 5 | | |
| | | 6 | | namespace Elsa.Http; |
| | | 7 | | |
| | | 8 | | /// <summary> |
| | | 9 | | /// Represents the headers of an HTTP message. |
| | | 10 | | /// </summary> |
| | | 11 | | [JsonConverter(typeof(HttpHeadersConverter))] |
| | | 12 | | public class HttpHeaders : Dictionary<string, string[]> |
| | | 13 | | { |
| | | 14 | | /// <inheritdoc /> |
| | 161 | 15 | | public HttpHeaders() |
| | | 16 | | { |
| | 161 | 17 | | } |
| | | 18 | | |
| | | 19 | | /// <inheritdoc /> |
| | 0 | 20 | | public HttpHeaders(IDictionary<string, string[]> source) |
| | | 21 | | { |
| | 0 | 22 | | foreach (var item in source) |
| | 0 | 23 | | Add(item.Key, item.Value); |
| | 0 | 24 | | } |
| | | 25 | | |
| | | 26 | | /// <inheritdoc /> |
| | 41 | 27 | | public HttpHeaders(HttpResponseHeaders source) |
| | | 28 | | { |
| | 94 | 29 | | foreach (var item in source) |
| | 6 | 30 | | Add(item.Key, item.Value.ToArray()); |
| | 41 | 31 | | } |
| | | 32 | | |
| | | 33 | | /// <inheritdoc /> |
| | 19 | 34 | | public HttpHeaders(HttpContentHeaders source) |
| | | 35 | | { |
| | 116 | 36 | | foreach (var item in source) |
| | 39 | 37 | | Add(item.Key, item.Value.ToArray()); |
| | 19 | 38 | | } |
| | | 39 | | |
| | | 40 | | /// <summary> |
| | | 41 | | /// Gets the content type. |
| | | 42 | | /// </summary> |
| | 0 | 43 | | public string? ContentType => this.GetValue("content-type")?[0]; |
| | | 44 | | } |