Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions TonSdk.Client/src/HttpApi/HttpsApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ internal HttpApi(HttpParameters httpApiParameters)

if (!string.IsNullOrEmpty(httpApiParameters.ApiKey))
_httpClient.DefaultRequestHeaders.Add("X-API-Key", httpApiParameters.ApiKey);
else if (!string.IsNullOrEmpty(httpApiParameters.BearerToken))
_httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", httpApiParameters.BearerToken);

_httpClient.BaseAddress = new Uri(httpApiParameters.Endpoint);
}
Expand Down
5 changes: 3 additions & 2 deletions TonSdk.Client/src/HttpApi/HttpsApiV3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ public HttpApiV3(HttpParameters httpApiParameters)
_httpClient.Timeout = TimeSpan.FromMilliseconds(Convert.ToDouble(httpApiParameters.Timeout ?? 30000));

_httpClient.DefaultRequestHeaders.Accept.Clear();



if (!string.IsNullOrEmpty(httpApiParameters.ApiKey))
_httpClient.DefaultRequestHeaders.Add("X-API-Key", httpApiParameters.ApiKey);
else if (!string.IsNullOrEmpty(httpApiParameters.BearerToken))
_httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", httpApiParameters.BearerToken);

_httpClient.BaseAddress = new Uri(httpApiParameters.Endpoint);
}
Expand Down
2 changes: 2 additions & 0 deletions TonSdk.Client/src/HttpApi/HttpsWhales.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ internal HttpWhales(HttpParameters httpApiParameters)

if (!string.IsNullOrEmpty(httpApiParameters.ApiKey))
_httpClient.DefaultRequestHeaders.Add("X-API-Key", httpApiParameters.ApiKey);
else if (!string.IsNullOrEmpty(httpApiParameters.BearerToken))
_httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", httpApiParameters.BearerToken);

_httpClient.BaseAddress = new Uri(httpApiParameters.Endpoint);
}
Expand Down
1 change: 1 addition & 0 deletions TonSdk.Client/src/Models/Models.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class HttpParameters : ITonClientOptions
public string Endpoint { get; set; }
public int? Timeout { get; set; }
public string ApiKey { get; set; }
public string BearerToken { get; set; }
}

public class LiteClientParameters : ITonClientOptions
Expand Down