/// <summary> /// Adds an HMAC header to a HttpClient using the registered header generator /// </summary> /// <param name="client">The client that will be used to make the request</param> /// <param name="requestUri">The Uri that the request will be sent to</param> /// <param name="method">The method that the request will be used</param> /// <param name="content">The content of the request</param> /// <exception cref="NullReferenceException">If no valid header generator is registered</exception> public static void AddHmacHeaders(this HttpClient client, Uri requestUri, HttpMethod method, string content) { if (!IsAnyHeaderGeneratorRegisteredProp) { throw new InvalidOperationException("Unable to add headers without a registered generator. Please register a generator first."); } _registeredGenerator.AddHmacHeaders(client, requestUri, method, content); }
/// <summary> /// Adds an HMAC header to a HttpClient using the provided header generator /// </summary> /// <param name="client">The client that will be used to make the request</param> /// <param name="requestUri">The Uri that the request will be sent to</param> /// <param name="method">The method that the request will be used</param> /// <param name="content">The content of the request</param> /// <param name="headerGenerator">The header generator to use (this will not be registered)</param> /// <exception cref="NullReferenceException">If no valid header generator was passed</exception> public static void AddHmacHeadersWithGenerator(this HttpClient client, Uri requestUri, HttpMethod method, string content, HmacHeaderGenerator headerGenerator) { if (headerGenerator == null) { throw new NullReferenceException("No valid header generator passed."); } headerGenerator.AddHmacHeaders(client, requestUri, method, content); }