Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions JsonRpc.Http/HttpRpcClientHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ public Encoding Encoding
/// <value>Content-Type header value, or <c>null</c> to suppress Content-Type header.</value>
public string ContentType { get; set; } = "application/json-rpc";

/// <summary>
/// Authentication token header value.
/// </summary>
/// <value>Bearer Authentication token header value.</value>
public string AuthToken { get; set; }

// Looking for EmitContentCharset? No, StringContent will automatically append charset to the
// end of the Content-Type of the requests.

Expand Down Expand Up @@ -95,6 +101,11 @@ protected virtual HttpRequestMessage GetHttpRequestMessage(RequestMessage reques
};
if (!string.IsNullOrEmpty(UserAgent)) req.Headers.UserAgent.ParseAdd(UserAgent);
req.Headers.UserAgent.Add(new ProductInfoHeaderValue("JsonRpc.Http", "0.3"));
if (!string.IsNullOrEmpty(AuthToken))
{
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", AuthToken);
}

return req;
}

Expand Down