Ejemplo n.º 1
0
 public SolidHttpClientFactory(IServiceProvider services, ILogger <SolidHttpClientFactory> logger, IOptionsMonitor <SolidHttpOptions> monitor)
 {
     _services           = services;
     _logger             = logger;
     Options             = monitor.CurrentValue;
     _optionsChangeToken = monitor.OnChange((options, _) => Options = options);
 }
Ejemplo n.º 2
0
 public SolidHttpClient(IServiceProvider services, IOptions <SolidHttpOptions> options)
 {
     _services = services;
     _options  = options.Value;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Registers an event handler that is run just before the <see cref="HttpRequestMessage" /> is sent to the <seealso cref="HttpClient" />.
 /// </summary>
 /// <param name="options">The <see cref="SolidHttpOptions" /> that is being extended.</param>
 /// <param name="handler">An event handler that is run just before <see cref="HttpRequestMessage" /> is sent to the <seealso cref="HttpClient" />.</param>
 /// <returns>The <see cref="SolidHttpOptions" /> so that additional calls can be chained.</returns>
 public static SolidHttpOptions OnHttpRequest(this SolidHttpOptions options, Action <IServiceProvider, HttpRequestMessage> handler)
 {
     options.OnHttpRequestAsync = options.OnHttpRequestAsync.Add(handler);
     return(options);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Registers a handler that is run when an <see cref="ISolidHttpRequest" /> is created.
 /// </summary>
 /// <param name="options">The <see cref="SolidHttpOptions" /> that is being extended.</param>
 /// <param name="handler">The event handler that runs when a new <see cref="ISolidHttpRequest" /> is created.</param>
 /// <returns>The <see cref="SolidHttpOptions" /> so that additional calls can be chained.</returns>
 public static SolidHttpOptions OnRequestCreated(this SolidHttpOptions options, Action <IServiceProvider, ISolidHttpRequest> handler)
 {
     options.OnRequestCreated = options.OnRequestCreated.Add(handler);
     return(options);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Registers a handler that is run when an <see cref="ISolidHttpClient" /> is created.
 /// </summary>
 /// <param name="options">The <see cref="SolidHttpOptions" /> that is being extended.</param>
 /// <param name="handler">The event handler that runs when a new <see cref="ISolidHttpClient" /> is created.</param>
 /// <returns>The <see cref="SolidHttpOptions" /> so that additional calls can be chained.</returns>
 public static SolidHttpOptions OnClientCreated(this SolidHttpOptions options, Action <ISolidHttpClient> handler)
 {
     options.OnClientCreated = options.OnClientCreated.Add(handler);
     return(options);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Registers an event handler that is run just after the <see cref="HttpResponseMessage" /> is receied by the <seealso cref="HttpClient" />.
 /// </summary>
 /// <param name="options">The <see cref="SolidHttpOptions" /> that is being extended.</param>
 /// <param name="handler">An event handler that is run just after the <see cref="HttpResponseMessage" /> is received by the <seealso cref="HttpClient" />.</param>
 /// <returns>The <see cref="SolidHttpOptions" /> so that additional calls can be chained.</returns>
 public static SolidHttpOptions OnHttpResponse(this SolidHttpOptions options, Func <HttpResponseMessage, ValueTask> handler)
 {
     options.OnHttpResponseAsync = options.OnHttpResponseAsync.Add(handler);
     return(options);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Registers an event handler that is run just after the <see cref="HttpResponseMessage" /> is receied by the <seealso cref="HttpClient" />.
 /// </summary>
 /// <param name="options">The <see cref="SolidHttpOptions" /> that is being extended.</param>
 /// <param name="handler">An event handler that is run just after the <see cref="HttpResponseMessage" /> is received by the <seealso cref="HttpClient" />.</param>
 /// <returns>The <see cref="SolidHttpOptions" /> so that additional calls can be chained.</returns>
 public static SolidHttpOptions OnHttpResponse(this SolidHttpOptions options, Action <HttpResponseMessage> handler)
 {
     options.OnHttpResponseAsync = options.OnHttpResponseAsync.Add(handler);
     return(options);
 }