Porting some code from Simple.OData.Client and having some issues with where to set the base url.
Only on the required ODataClientOptions object - Invalid request Uri exception
var baseUrl = "https://services.odata.org/V4/Northwind/Northwind.svc";
using var httpClient = new HttpClient();
using var client = new ODataClient(new ODataClientOptions
{
BaseUrl = baseUrl,
HttpClient = httpClient
});
var metadata = await client.GetMetadataAsync(cancellationToken: CancellationToken);
On both - Resource not found $metadata exception. (Works if the url ends in a slash)
var baseUrl = "https://services.odata.org/V4/Northwind/Northwind.svc";
using var httpClient = new HttpClient();
httpClient.BaseAddress = new Uri(baseUrl);
using var client = new ODataClient(new ODataClientOptions
{
BaseUrl = baseUrl,
HttpClient = httpClient
});
var metadata = await client.GetMetadataAsync(cancellationToken: CancellationToken);
No httpclient provided - Works
var baseUrl = "https://services.odata.org/V4/Northwind/Northwind.svc";
using var client = new ODataClient(new ODataClientOptions
{
BaseUrl = baseUrl
});
// Act
var metadata = await client.GetMetadataAsync(cancellationToken: CancellationToken);
If its a required property on ODataClientOptions it doesn't feel like HttpClient should need any configuration.
Porting some code from Simple.OData.Client and having some issues with where to set the base url.
Only on the required ODataClientOptions object - Invalid request Uri exception
On both - Resource not found $metadata exception. (Works if the url ends in a slash)
No httpclient provided - Works
If its a required property on ODataClientOptions it doesn't feel like HttpClient should need any configuration.