public OpenApiFactory(OpenApiOptions options, Func <HttpMessageHandler> httpMessageHandlerFactory, bool disposeHandler) { if (options.PortalUrl == null) { throw new ArgumentNullException($"{nameof(options)}.{nameof(options.PortalUrl)}"); } if (string.IsNullOrEmpty(options.Token)) { throw new ArgumentNullException($"{nameof(options)}.{nameof(options.Token)}"); } var baseUri = new UriBuilder(options.PortalUrl) { Path = "/openapi/v1/" }.Uri; var token = options.Token; _httpClientFactory = () => new HttpClient(httpMessageHandlerFactory(), disposeHandler) { BaseAddress = baseUri, DefaultRequestHeaders = { Authorization = new AuthenticationHeaderValue(token) }, Timeout = TimeSpan.FromMilliseconds(options.Timeout) }; }
public OpenApiFactory(OpenApiOptions options, Func <HttpMessageHandler> httpMessageHandlerFactory) : this(options, httpMessageHandlerFactory, true) { }
public OpenApiFactory(OpenApiOptions options) : this(options, () => Handler.Value, false) { }