diff --git a/ApiToolKit.cs b/ApiToolKit.cs index bdec8f6..f19f2e7 100644 --- a/ApiToolKit.cs +++ b/ApiToolKit.cs @@ -97,6 +97,18 @@ public async Task InvokeAsync(HttpContext context) requestBody = JsonConvert.SerializeObject(dictionary); } + else if (contentType != null && contentType.StartsWith("multipart/form-data")) + { + try + { + var form = await context.Request.ReadFormAsync(); + var formData = form.ToDictionary(x => x.Key, x => x.Value.ToString()); + requestBody = System.Text.Json.JsonSerializer.Serialize(formData); + + } + catch (Exception) { } + } + var payload = _client.BuildPayload("DotNet", stopwatch, context.Request, statusCode, System.Text.Encoding.UTF8.GetBytes(requestBody), System.Text.Encoding.UTF8.GetBytes(responseBody), responseHeaders, pathParams, urlPath, errors, msg_id);