Fix verbs and versioning
parent
f8878fb5d3
commit
1dd76f7c8e
|
@ -15,6 +15,6 @@ public class EpisodesHttpClient : IEpisodesClient
|
|||
|
||||
public async Task<Episode> GetEpisodeByIdAsync(Guid episodeId, CancellationToken cancellationToken)
|
||||
{
|
||||
return (await _httpClient.GetFromJsonAsync<Episode>($"v1/episodes/{episodeId}", cancellationToken))!;
|
||||
return (await _httpClient.GetFromJsonAsync<Episode>($"episodes/{episodeId}", cancellationToken))!;
|
||||
}
|
||||
}
|
|
@ -16,6 +16,7 @@ namespace ListenTogether.Infrastructure
|
|||
serviceCollection.AddHttpClient<IEpisodesClient, EpisodesHttpClient>(opt =>
|
||||
{
|
||||
opt.BaseAddress = new Uri(configuration["NetPodcastApi:BaseAddress"]);
|
||||
opt.DefaultRequestHeaders.Add("api-version", "1.0");
|
||||
});
|
||||
|
||||
return serviceCollection;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
|||
builder.Services.AddHttpClient<PodcastService>(
|
||||
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<ThemeInterop>();
|
||||
builder.Services.AddScoped<IAudioInterop, AudioInterop>();
|
||||
|
|
Loading…
Reference in New Issue