Closed
Description
I'm cannot figure out how to make Odata Batching to work when using API Versioing. I cannot tell if I'm missing configuration, or whether the issue is with Odata or API Versioning.
Using URL Segement versioning and the following configuration results in a 404 when making a GET request to api/v1/$batch, and 405 when making a POST request.
builder.Services.AddControllers().AddOData();
builder.Services.AddApiVersioning(
options =>
{
options.ApiVersionReader = new UrlSegmentApiVersionReader();
})
.AddOData(options =>
{
var defaultBatchHandler = new DefaultODataBatchHandler
{
MessageQuotas =
{
MaxNestingDepth = 2,
MaxOperationsPerChangeset = 10,
MaxReceivedMessageSize = 100
}
};
options.AddRouteComponents("api/v{version:apiVersion}", defaultBatchHandler);
});
...
app.UseHttpsRedirection();
app.UseAuthorization();
app.UseODataBatching();
app.MapControllers();
app.Run();
Expected behaviour is to get the expected OData response for POST, and 'The batch request must have a "Content-Type" header.' for GET.
Any help would be much appreciated.
Thanks to the author of this repo for all the hard work in maintaining this - the effort is much appreciated.