Stats API Url Fixed (#338)
* Fixed the API call by removing baseAddress and performing concatination in real time
This commit is contained in:
parent
be56b33baf
commit
6b645737fa
2 changed files with 3 additions and 2 deletions
|
@ -16,7 +16,6 @@ namespace API.Extensions
|
||||||
{
|
{
|
||||||
services.AddHttpClient<StatsApiClient>(client =>
|
services.AddHttpClient<StatsApiClient>(client =>
|
||||||
{
|
{
|
||||||
client.BaseAddress = new Uri("https://stats.kavitareader.com");
|
|
||||||
client.DefaultRequestHeaders.Add("api-key", "MsnvA2DfQqxSK5jh");
|
client.DefaultRequestHeaders.Add("api-key", "MsnvA2DfQqxSK5jh");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Json;
|
using System.Net.Http.Json;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using API.Configurations.CustomOptions;
|
using API.Configurations.CustomOptions;
|
||||||
|
@ -15,6 +16,7 @@ namespace API.Services.Clients
|
||||||
private readonly HttpClient _client;
|
private readonly HttpClient _client;
|
||||||
private readonly StatsOptions _options;
|
private readonly StatsOptions _options;
|
||||||
private readonly ILogger<StatsApiClient> _logger;
|
private readonly ILogger<StatsApiClient> _logger;
|
||||||
|
private const string ApiUrl = "http://stats.kavitareader.com";
|
||||||
|
|
||||||
public StatsApiClient(HttpClient client, IOptions<StatsOptions> options, ILogger<StatsApiClient> logger)
|
public StatsApiClient(HttpClient client, IOptions<StatsOptions> options, ILogger<StatsApiClient> logger)
|
||||||
{
|
{
|
||||||
|
@ -29,7 +31,7 @@ namespace API.Services.Clients
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var response = await _client.PostAsJsonAsync("/api/InstallationStats", data);
|
using var response = await _client.PostAsJsonAsync(ApiUrl + "/api/InstallationStats", data);
|
||||||
|
|
||||||
responseContent = await response.Content.ReadAsStringAsync();
|
responseContent = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue