Questions tagged [refit]
Refit is a library heavily inspired by Square's Retrofit library, and it turns your REST API into a live interface.
refit
220
questions
0
votes
1
answer
36
views
Send !DOCTYPE inside XML content using Refit
How could I be sure that every time Refit sends an API call to an endpoint the !DOCTYPE declaration is defined.
<?xml version="1.0"?>
<!DOCTYPE greeting SYSTEM "hello.dtd"&...
0
votes
1
answer
55
views
deserialization to class not working correctly
Trying to capture the Digicert Automation API with a Refit HttpClient Factory.
When my interface method is declared to return a string
Task<string> GetAgentList([Body] GetAgentListReq req);
I ...
0
votes
1
answer
118
views
Refit - FromForm / Multipart method not working with request object
I have a .NET 8 web API controller with the following endpoint method in it :
[HttpPost()]
[Route("someRoute")]
[ProducesResponseType(typeof(SomeResponse), StatusCodes.Status200OK)]
public ...
0
votes
1
answer
248
views
Refit - Deserialize response to supertype
This question does not necessarily relate to Refit itself but here we go. The built-in ApiResponse from Refit does not do exactly what I need. There seems to be no way of accessing the raw response ...
1
vote
0
answers
62
views
REFIT: Mix Post Workload Fields with Query String Params and Dynamic Header Items
Imagine I have a refit endpoint like this:
[Post("/api/v2/steps")]
Task CreateStep(CreateStepContext request);
I want to have one single context type that I can mix all the data items that ...
0
votes
0
answers
90
views
To Exclude Refit.dll from Test project Code Coverage on Azure Devops pipeline builds
I have Selenium based Automation project in .Net 6 that uses NUnit framework.
The CI/CD pipeline is configured in Azure Devops to run Code Coverage check and we see the Code Coverage results including ...
0
votes
1
answer
364
views
C# console app, refit API Request failed: Response status code does not indicate success: 424 (Failed Dependency)
I have created a net8 console application project and am trying to query using the refit library. I'm using Refit 7.0.0.
I don't know why this error occurs. I couldn't find anything about this error ...
0
votes
0
answers
120
views
Is it possible to use a concrete implementation, and Refit, to implement the same service in a Blazor Web App?
I'm building a Blazor Web App. I have identified that some pages and components need access to some external data, and I have defined an interface that allows them to access these data.
public ...
2
votes
2
answers
2k
views
HTTP connection failure when calling local API from .Net MAUI view
When calling my locally hosted API from my android emulator's .NET MAUI app, I receive an error message stating that the HTTP connection failed.
I am able to successfully send requests to my local API ...
0
votes
0
answers
82
views
Can not deserialize API response of type Results<TResult1,TResult2>
I have API with endpoint like
public class SampleEndpoint: Endpoint<SampleEndpointQuery, Results<Ok<SampleResponse>, NotFound>>
And everything works fine via swagger or Postman, but ...
1
vote
0
answers
127
views
Using Refit to add tokens in Blazor wasm
Unsure why this does not work:
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.Services.AddHttpClient("myApi").AddHttpMessageHandler<CustomAuthorizationMessageHandler&...
2
votes
1
answer
209
views
How to pass path params using command in REFIT .NET
This is my refit interface
public interface IRefitInterface
{
[Get("/v1/report/student-statement")]
Task<GetStudentRecordResponse> GetStudentsRecordsAsync(
...
0
votes
0
answers
93
views
Refit Fails to Deserialize When Publishing .NET MAUI App to Android
I'm developing a .NET MAUI app that calls a web API using Refit. The app works as expected when running in an emulator or during debugging on my Samsung Galaxy S21. However, when I publish the app as ...
1
vote
1
answer
227
views
Issue with Refit and Polly Configuration Retry
I'm encountering an issue with my Refit and Polly configuration for handling HTTP requests and retries. But it not working. Please assist me for this code Here's the relevant code:
services....
0
votes
0
answers
96
views
How can one Dispose() a Refit connection made w/ RestService.For<IRestInterface>
I am creating an interface for a REST API using Refit as follows:
var settingsXml = new RefitSettings
{
ContentSerializer = new XmlContentSerializer(new XmlContentSerializerSettings())
};
this.api ...