diff --git a/src/Services/ListenTogether/ListenTogether.Infrastructure/Http/EpisodesHttpClient.cs b/src/Services/ListenTogether/ListenTogether.Infrastructure/Http/EpisodesHttpClient.cs index cfb2427..b2b2ce4 100644 --- a/src/Services/ListenTogether/ListenTogether.Infrastructure/Http/EpisodesHttpClient.cs +++ b/src/Services/ListenTogether/ListenTogether.Infrastructure/Http/EpisodesHttpClient.cs @@ -15,6 +15,6 @@ public class EpisodesHttpClient : IEpisodesClient public async Task GetEpisodeByIdAsync(Guid episodeId, CancellationToken cancellationToken) { - return (await _httpClient.GetFromJsonAsync($"v1/episodes/{episodeId}", cancellationToken))!; + return (await _httpClient.GetFromJsonAsync($"episodes/{episodeId}", cancellationToken))!; } } \ No newline at end of file diff --git a/src/Services/ListenTogether/ListenTogether.Infrastructure/ServiceCollectionsExtensions.cs b/src/Services/ListenTogether/ListenTogether.Infrastructure/ServiceCollectionsExtensions.cs index 2d948f0..f13403a 100644 --- a/src/Services/ListenTogether/ListenTogether.Infrastructure/ServiceCollectionsExtensions.cs +++ b/src/Services/ListenTogether/ListenTogether.Infrastructure/ServiceCollectionsExtensions.cs @@ -16,6 +16,7 @@ namespace ListenTogether.Infrastructure serviceCollection.AddHttpClient(opt => { opt.BaseAddress = new Uri(configuration["NetPodcastApi:BaseAddress"]); + opt.DefaultRequestHeaders.Add("api-version", "1.0"); }); return serviceCollection; diff --git a/src/Services/Podcasts/Podcast.MinimalAPI/Program.cs b/src/Services/Podcasts/Podcast.MinimalAPI/Program.cs index 3d5cc1f..814efd2 100644 --- a/src/Services/Podcasts/Podcast.MinimalAPI/Program.cs +++ b/src/Services/Podcasts/Podcast.MinimalAPI/Program.cs @@ -45,6 +45,7 @@ builder.Services.AddApiVersioning(options => options.DefaultApiVersion = new ApiVersion(2, 0); options.ReportApiVersions = true; options.AssumeDefaultVersionWhenUnspecified = true; + options.ApiVersionReader = new HeaderApiVersionReader("api-version"); }); builder.Services.AddOutputCache(); diff --git a/src/Services/Podcasts/Podcast.MinimalAPI/Routes/CategoriesApi.cs b/src/Services/Podcasts/Podcast.MinimalAPI/Routes/CategoriesApi.cs index f4de851..e0d9bbc 100644 --- a/src/Services/Podcasts/Podcast.MinimalAPI/Routes/CategoriesApi.cs +++ b/src/Services/Podcasts/Podcast.MinimalAPI/Routes/CategoriesApi.cs @@ -10,7 +10,7 @@ public static class CategoriesApi { public static RouteGroupBuilder MapCategoriesApi(this RouteGroupBuilder group) { - group.MapPost("/", GetAllCategories).WithName("GetCategories"); + group.MapGet("/", GetAllCategories).WithName("GetCategories"); return group; } diff --git a/src/Web/Client/Program.cs b/src/Web/Client/Program.cs index 25e550c..ef90182 100644 --- a/src/Web/Client/Program.cs +++ b/src/Web/Client/Program.cs @@ -8,7 +8,7 @@ var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.Services.AddHttpClient( client => { client.BaseAddress = new Uri(builder.Configuration["PodcastApi:BaseAddress"]!); - client.DefaultRequestHeaders.Add("api-supported-versions", "1.0,2.0"); + client.DefaultRequestHeaders.Add("api-version", "1.0"); }); builder.Services.AddScoped(); builder.Services.AddScoped();