Asp.Net Web Api trailing / causing odata query to fail

I am using HttpClient to query the WebApi controller using the below code:

        var uri = new Uri(url);
        var message = new HttpRequestMessage(method, uri);
        if (content != null) message.Content = new StringContent(content, Encoding.UTF8, "application/json");

        var client = new HttpClient();
        if (content != null) Debug.WriteLine($"Payload:\n {content}");
        var response = await client.SendAsync(message);
        return response;

The generated Url is as below:

Note the trailing ‘/’. This causes the OData Validation (code below) to fail:

    public async Task GetRoles(ODataQueryOptions options)

        var filteredResults = await _roleService.GetRolesAsync(options);
        return Ok(filteredResults);


    public void GuardForODataException(ODataQueryOptions options)
            var validationSettings = new ODataValidationSettings();
        catch (Exception e)

            var result =
                new ValidationFailedResult(
                        new ValidationResultModel(
                            new ValidationResult(
                                new List { new ValidationFailure("", "Odata Query is invalid") })));

            throw new HttpResponseException(result.ExecuteAsync(default(CancellationToken)).Result);

The exception I am getting is

“An identifier was expected at position 9.”

If however, I remove the trailing /, then the odata query returns the expected results.

I wasn’t able to find much on how to construct a HttpRequestMessage without the / at the end. Has anyone encountered this before?