StubHttp.CreateClient(string) method¶
Defined in
Type: StubHttp
Namespace: Refit.Testing
Assembly: Refit.Testing.dll
Applies to
net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481, net471
Overloads¶
- 1.
public T CreateClient<T>(string hostUrl) - 2.
public T CreateClient<T>(string hostUrl, RefitSettings baseSettings)
1. Overload¶
Attributes: [RequiresUnreferencedCode("Creating a Refit client through the reflection path requires runtime type lookup and request metadata.")]
public T CreateClient<T>(string hostUrl)
Summary:
Creates a Refit implementation of T whose HTTP requests are routed through this
handler. A one-line replacement for RestService.For<T>(hostUrl, handler.ToSettings()).
Type parameters
| Name | Description |
|---|---|
T | The Refit interface to implement. |
Parameters
| Name | Type | Description |
|---|---|---|
hostUrl | string | The base address the client sends requests to. |
Returns: T -- A Refit client that sends every request to this handler.
2. Overload¶
Attributes: [RequiresUnreferencedCode("Creating a Refit client through the reflection path requires runtime type lookup and request metadata.")]
public T CreateClient<T>(string hostUrl, RefitSettings baseSettings)
Summary:
Creates a Refit implementation of T whose HTTP requests are routed through this
handler, starting from the supplied settings. Use this overload to keep a custom serializer or
URL-resolution configuration; the settings' handler factory is pointed at this handler.
Type parameters
| Name | Description |
|---|---|
T | The Refit interface to implement. |
Parameters
| Name | Type | Description |
|---|---|---|
hostUrl | string | The base address the client sends requests to. |
baseSettings | [RefitSettings](# | The settings to route through this handler. |
Returns: T -- A Refit client that sends every request to this handler.