Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trouble getting started, Visual Studio + Refit example #49

Open
adamfoneil opened this issue Dec 18, 2020 · 6 comments
Open

trouble getting started, Visual Studio + Refit example #49

adamfoneil opened this issue Dec 18, 2020 · 6 comments
Assignees
Labels
question Further information is requested

Comments

@adamfoneil
Copy link

Hi there, I found your library in the course of trying to troubleshoot a Refit issue. It's one of those cases where I can make it work in Postman, but I'm not sure how to reproduce it correctly for Refit. The issue is I'm not seeing any trace output in the Debug window when I run my project. I've made a little walkthrough:

https://1drv.ms/u/s!AvguHRnyJtWMmeh7C8wHrd7X8BbDyA?e=tcCcNZ

Here's my relevant code:
https://github.com/adamfoneil/GitHubApi/blob/master/MicropubApi.Library/MicropubApiClient.cs#L17

@adamfoneil
Copy link
Author

I went ahead and used Fiddler to get debug my immediate issue.
The line number URL above is no longer relevant because I removed the trace stuff, but I'm still interested to hear your feedback.

@DanielCauser
Copy link
Contributor

Hey Adam, I've setup our lib with Refit before, I will write something up and share, so you can check out too.

@ChaseFlorell
Copy link
Collaborator

@DanielCauser did you ever get around to doing your writeup?

@ChaseFlorell ChaseFlorell added the question Further information is requested label Aug 3, 2021
@DanielCauser
Copy link
Contributor

I did, and I will bring this up here this weekend.

@ChaseFlorell
Copy link
Collaborator

Perhaps a Wiki in the new organization?

@hamid-shaikh
Copy link

hamid-shaikh commented Aug 29, 2022

Refit + HttpTracer Example

Checkout below steps for Refit
https://gist.github.com/hamid-shaikh/24d93419f9b5313685c4dfc40f4b59dc

For HttpTracer implementation just simply replace HttpClient creation with below snippet

    HttpClient restClient;
    HttpClient RestClient
    {
        get
        {
            if (restClient != null)
                return restClient;

            var builder = new HttpHandlerBuilder();

            builder.AddHandler(new AppMessageHandler());

            var tracer = builder.Build();

            restClient = new HttpClient(tracer)
            {
                BaseAddress = new Uri(GetBaseAddress()),//App Base URI
                Timeout = TimeSpan.FromSeconds(APIConstants.Timeout)//Timeout time for HTTP Request
            };

            restClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            return restClient;
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants