<PackageReference Include="Refit" Version="15.2.0" />

Refit.RefitSettings

public class RefitSettings
Defines various parameters on how Refit should work.
public bool AllowUnmatchedRouteParameters { get; set; }

Gets or sets a value indicating whether a route placeholder with no matching method argument is allowed. When false (the default) Refit throws while building the method; when true the unmatched {token} is left in the URL verbatim so it can be rewritten later, for example inside a DelegatingHandler.

Gets or sets a function to provide the Authorization header. Does not work if you supply an HttpClient instance.

public bool Buffered { get; set; }

Gets or sets a value indicating whether the request's body content is buffered before sending. (defaults to false, request body is not streamed to the server).

public bool CaptureMethodArguments { get; set; }

Gets or sets a value indicating whether the current call's argument values are captured, in declared parameter order, into the MethodArguments request option so a DelegatingHandler can inspect them (defaults to false).

public bool CaptureRequestContent { get; set; }

Gets or sets a value indicating whether the request body is captured as a string before sending so it can be read from RequestContent when a request fails (defaults to false).

public CollectionFormat CollectionFormat { get; set; }

Gets or sets the default collection format to use. (defaults to RefitParameterFormatter).

Gets or sets how requests' content should be serialized. (defaults to SystemTextJsonContentSerializer).

Gets or sets a function to provide Exception when deserialization exception is encountered. If function returns null - no exception is thrown.

Gets or sets a function to provide Exception based on HttpResponseMessage. If function returns null - no exception is thrown.

Gets or sets a hook invoked just before an ApiExceptionBase is returned, allowing sensitive data to be scrubbed before the exception propagates (defaults to null).

Gets or sets the IFormUrlEncodedParameterFormatter instance to use (defaults to DefaultFormUrlEncodedParameterFormatter).

Gets or sets a value indicating whether a query object's flattened property keys honor the content serializer's property name (for example [JsonPropertyName] with the default System.Text.Json serializer, or [JsonProperty] with Refit.Newtonsoft.Json), matching how form-encoded field names are resolved (defaults to true).

Gets or sets a custom inner HttpMessageHandler. Does not work if you supply an HttpClient instance.

public Dictionary<string, object> HttpRequestMessageOptions { get; set; }

Gets optional Key-Value pairs, which are displayed in the property Properties.

public int? MaxExceptionContentLength { get; set; }

Gets or sets the maximum number of characters of an error response body that are read into Content (defaults to null, meaning unbounded).

Gets or sets how JSON request bodies are serialized (defaults to Default). Buffered and Streamed use the synchronous serialization path so the System.Text.Json source-generated fast-path can engage; both require the configured ContentSerializer to implement ISynchronousContentSerializer.

Gets or sets the content coding applied to every request body (defaults to None). A [Body] parameter naming its own coding overrides this, and None on the parameter opts that one method out.

Gets or sets how hard RequestCompression compresses (defaults to Optimal).

public IList<Type> ReturnTypeAdapters { get; }

Gets the return-type adapters the opt-in reflection request builder uses to surface custom return shapes (for example IObservable<T> or Result<T>) from interface methods.

Gets or sets a factory invoked when SendAsync throws a transport-level exception, giving callers full control over the exception that is ultimately surfaced.

Gets or sets the IUrlParameterFormatter instance to use (defaults to DefaultUrlParameterFormatter).

Gets a registry of IUrlParameterFormatter instances keyed by the CLR type they format, consulted before UrlParameterFormatter when rendering a value into a path or query string.

Gets or sets the IUrlParameterKeyFormatter instance to use for formatting URL parameter keys (defaults to DefaultUrlParameterKeyFormatter). Allows customization of key naming conventions.

public UrlResolutionMode UrlResolution { get; set; }

Gets or sets how the client's base address is combined with a method's relative URL (defaults to RefitLegacy). Set to Rfc3986 to opt in to RFC 3986 / HttpClient style resolution.

public bool ValidateHeaders { get; set; }

Gets or sets a value indicating whether header values are validated against the framework's header parsers when they are applied to a request (defaults to false).

public RefitSettings()

Initializes a new instance of the RefitSettings class.

public RefitSettings(IHttpContentSerializer contentSerializer)

Initializes a new instance of the RefitSettings class.

public RefitSettings(IHttpContentSerializer contentSerializer, IUrlParameterFormatter urlParameterFormatter)

Initializes a new instance of the RefitSettings class.

public RefitSettings(IHttpContentSerializer contentSerializer, IUrlParameterFormatter urlParameterFormatter, IFormUrlEncodedParameterFormatter formUrlEncodedParameterFormatter)

Initializes a new instance of the RefitSettings class.

public RefitSettings(IHttpContentSerializer contentSerializer, IUrlParameterFormatter urlParameterFormatter, IFormUrlEncodedParameterFormatter formUrlEncodedParameterFormatter, IUrlParameterKeyFormatter urlParameterKeyFormatter)

Initializes a new instance of the RefitSettings class.

public static RefitSettings CamelCase()

Creates settings whose query keys, form-url-encoded keys, and JSON body property names are all formatted in camelCase.

public static RefitSettings KebabCase()

Creates settings whose query keys, form-url-encoded keys, and JSON body property names are all formatted in kebab-case.

public static RefitSettings SnakeCase()

Creates settings whose query keys, form-url-encoded keys, and JSON body property names are all formatted in snake_case.