Skip to content

HttpClient BaseAddress not used - doesn't contain a valid scheme for an empty base URL #1727

@Basyras

Description

@Basyras

Is your feature request related to a problem? Please describe.
Creating new RestRequest(HttpClient) will not use HttpClient base address and fails if you try execute request like this: new RestRequest("GetAll") with message:

System.ArgumentOutOfRangeException : Request resource doesn't contain a valid scheme for an empty base URL of the client (Parameter 'request')

Describe the solution you'd like
make new RestRequest(HttpClient) ctor automatically assign HttpClient.BaseAddress to RestClient.Options.BaseUrl

Describe alternatives you've considered

var httpClient = new HttpClient() { BaseAddress = new Uri("https://localhost:1234/api/Product/v1/") };           
var client = new RestClient(httpClient, new RestClientOptions(httpClient.BaseAddress));

Additional context
If there is a good reason for not doing this automatically, perhaps just update the error message describing this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions