Class HttpRequestMessageFactory
A
Inheritance
System.Object
HttpRequestMessageFactory
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Geko.HttpClientService.Infrastructure
Assembly: Geko.HttpClientService.dll
Syntax
public class HttpRequestMessageFactory : IHttpRequestMessageFactory
Constructors
| Improve this Doc View SourceHttpRequestMessageFactory(IHttpContextAccessor, IOptions<HttpClientServiceOptions>)
Constructor of the HttpRequestMessageFactory
Declaration
public HttpRequestMessageFactory(IHttpContextAccessor httpContextAccessor, IOptions<HttpClientServiceOptions> options)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Http.IHttpContextAccessor | httpContextAccessor | The Microsoft.AspNetCore.Http.HttpContextAccessor object to access Microsoft.AspNetCore.Http.HttpContext. |
Microsoft.Extensions.Options.IOptions<HttpClientServiceOptions> | options | The HttpClientService options to use. |
Methods
| Improve this Doc View SourceCreateRequestMessage()
Adds an X-HttpClientService
header in the newly created X-HttpClientService
of the current request.
If there is no current request or the current request does not contain a X-HttpClientService
header, it creates a new one.
Declaration
public HttpRequestMessage CreateRequestMessage()
Returns
Type | Description |
---|---|
HttpRequestMessage | An |
Remarks
This is useful to track in the logs a series of cascading requests between services.