Skip to content

IRaftHttpCluster set custom http request headers? #95

Closed Answered by Arkensor
Arkensor asked this question in Q&A
Discussion options

You must be logged in to vote

I have no idea if this is a "clean" solution or could otherwise be optimized but I wanted to share my working approach if others ever need it. @sakno Thank you for the hint with the delegating handlers! I only looked at the SocketsHttpHandler and tried to make it add my headers ... I did not really understand the concept of how the IHttpMessageHandlerFactory can be used.

    public class RaftClientHandlerFactory : IHttpMessageHandlerFactory
    {
        public HttpMessageHandler CreateHandler(string name)
        {
            if (name == "raftClient") return new RaftMessageHandler(new SocketsHttpHandler { ConnectTimeout = TimeSpan.FromMilliseconds(AppSettings.ConnectionTimeout) });

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
2 replies
@Arkensor
Comment options

@sakno
Comment options

Comment options

You must be logged in to vote
4 replies
@sakno
Comment options

@Arkensor
Comment options

@sakno
Comment options

@Arkensor
Comment options

Answer selected by Arkensor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants