diff --git a/src/HttpRequestData.Extensions/HttpRequestData.Extensions/HttpRequestDataExtensions.cs b/src/HttpRequestData.Extensions/HttpRequestData.Extensions/HttpRequestDataExtensions.cs index fb6b389..360af71 100644 --- a/src/HttpRequestData.Extensions/HttpRequestData.Extensions/HttpRequestDataExtensions.cs +++ b/src/HttpRequestData.Extensions/HttpRequestData.Extensions/HttpRequestDataExtensions.cs @@ -79,7 +79,8 @@ public static async Task CreateResponseAsync( /// /// The for this response. /// A with a status of Internal Server Error (500). - public static HttpResponseData CreateErrorResponseAsync(this HttpRequestData httpRequestData) + public static HttpResponseData CreateErrorResponse( + this HttpRequestData httpRequestData) { return httpRequestData.CreateResponse(HttpStatusCode.InternalServerError); } @@ -90,7 +91,9 @@ public static HttpResponseData CreateErrorResponseAsync(this HttpRequestData htt /// The for this response. /// The causing the Internal Server Error to be returned. /// A with a status of Internal Server Error (500) and a response body with the message from . - public static HttpResponseData CreateErrorResponseAsync(this HttpRequestData httpRequestData, Exception exception) + public static HttpResponseData CreateErrorResponse( + this HttpRequestData httpRequestData, + Exception exception) { if (exception == default) throw new ArgumentNullException(nameof(exception)); HttpResponseData response = httpRequestData.CreateResponse(HttpStatusCode.InternalServerError); @@ -105,7 +108,8 @@ public static HttpResponseData CreateErrorResponseAsync(this HttpRequestData htt /// The to be interrogated for the request object. /// A representing the request object from the request. /// Thrown if there is an error reading the request object from the request. - public static Task GetRequestParameters(this HttpRequestData httpRequestData) where T : new() + public static Task GetRequestParametersAsync( + this HttpRequestData httpRequestData) where T : new() { return GetRequestParametersAsync(httpRequestData, new Dictionary(), new JsonSerializerOptions()); } @@ -118,11 +122,28 @@ public static HttpResponseData CreateErrorResponseAsync(this HttpRequestData htt /// Any route values supplied to the Azure Function. /// A representing the request object from the request. /// Thrown if there is an error reading the request object from the request. - public static Task GetRequestParameters(this HttpRequestData httpRequestData, Dictionary routeValues) where T : new() + public static Task GetRequestParametersAsync( + this HttpRequestData httpRequestData, + Dictionary routeValues) where T : new() { return GetRequestParametersAsync(httpRequestData, routeValues, new JsonSerializerOptions()); } + /// + /// Get a request object from the provide . + /// + /// The type of the request object to be returned. + /// The to be interrogated for the request object. + /// The serializer options for formatting the request body. + /// A representing the request object from the request. + /// Thrown if there is an error reading the request object from the request. + public static Task GetRequestParametersAsync( + this HttpRequestData httpRequestData, + JsonSerializerOptions jsonSerializerOptions) where T : new() + { + return GetRequestParametersAsync(httpRequestData, default, jsonSerializerOptions); + } + /// /// Get a request object from the provide . ///