Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 03399cf

Browse files
committed
Use generic reusable names for Headers
1 parent 2d7eacc commit 03399cf

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/ServiceStack.Text/HttpRequestConfig.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@ public class HttpRequestConfig
1111
public string? Accept { get; set; }
1212
public string? UserAgent { get; set; }
1313
public string? ContentType { get; set; }
14-
public HttpHeader? Authorization { get; set; }
15-
public RangeHeader? Range { get; set; }
16-
public List<HttpHeader> Headers { get; set; } = new();
14+
public NameValue? Authorization { get; set; }
15+
public LongRange? Range { get; set; }
16+
public List<NameValue> Headers { get; set; } = new();
1717

1818
public string AuthBearer
1919
{
2020
set => Authorization = new("Bearer", value);
2121
}
2222

23-
public HttpHeader AuthBasic
23+
public NameValue AuthBasic
2424
{
2525
set => Authorization = new("Basic",
2626
Convert.ToBase64String(Encoding.UTF8.GetBytes(value.Name + ":" + value.Value)));
2727
}
2828
}
2929

30-
public record HttpHeader
30+
public record NameValue
3131
{
32-
public HttpHeader(string name, string value)
32+
public NameValue(string name, string value)
3333
{
3434
this.Name = name;
3535
this.Value = value;
@@ -45,9 +45,9 @@ public void Deconstruct(out string name, out string value)
4545
}
4646
}
4747

48-
public record RangeHeader
48+
public record LongRange
4949
{
50-
public RangeHeader(long from, long? to = null)
50+
public LongRange(long from, long? to = null)
5151
{
5252
this.From = from;
5353
this.To = to;

src/ServiceStack.Text/HttpUtils.HttpClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ public static HttpRequestMessage With(this HttpRequestMessage httpReq, Action<Ht
11121112
}
11131113

11141114
public static void DownloadFileTo(this string downloadUrl, string fileName,
1115-
List<HttpHeader>? headers = null)
1115+
List<NameValue>? headers = null)
11161116
{
11171117
var client = Create();
11181118
var httpReq = new HttpRequestMessage(HttpMethod.Get, downloadUrl)

src/ServiceStack.Text/HttpUtils.WebRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ private static byte[] GetHeaderBytes(string fileName, string mimeType, string fi
10741074
}
10751075

10761076
public static void DownloadFileTo(this string downloadUrl, string fileName,
1077-
List<HttpHeader> headers = null)
1077+
List<NameValue> headers = null)
10781078
{
10791079
var webClient = new WebClient();
10801080
if (headers != null)

0 commit comments

Comments
 (0)