diff --git a/Frends.Community.Multipart.SendMultipartRequest/Definition.cs b/Frends.Community.Multipart.SendMultipartRequest/Definition.cs
index c0fdf84..fbe61ac 100644
--- a/Frends.Community.Multipart.SendMultipartRequest/Definition.cs
+++ b/Frends.Community.Multipart.SendMultipartRequest/Definition.cs
@@ -143,6 +143,12 @@ public class TextData
/// Value for the header.
///
public string Value { get; set; }
+
+ ///
+ /// Type of text data.
+ ///
+ [DefaultValue(TextType.String)]
+ public TextType ContentType { get; set; }
}
///
@@ -189,3 +195,12 @@ public enum HttpMethod
POST,
PUT
}
+
+///
+/// Enum for selecting text data type.
+///
+public enum TextType
+{
+ String,
+ JSON
+}
diff --git a/Frends.Community.Multipart.SendMultipartRequest/Frends.Community.Multipart.SendMultipartRequest.csproj b/Frends.Community.Multipart.SendMultipartRequest/Frends.Community.Multipart.SendMultipartRequest.csproj
index 6590c43..c58ccb8 100644
--- a/Frends.Community.Multipart.SendMultipartRequest/Frends.Community.Multipart.SendMultipartRequest.csproj
+++ b/Frends.Community.Multipart.SendMultipartRequest/Frends.Community.Multipart.SendMultipartRequest.csproj
@@ -10,7 +10,7 @@
Frends
Frends task for sending multipart/form-data requests.
true
- 1.3.0
+ 1.4.0
diff --git a/Frends.Community.Multipart.SendMultipartRequest/SendMultipartRequest.cs b/Frends.Community.Multipart.SendMultipartRequest/SendMultipartRequest.cs
index ea80f32..1618603 100644
--- a/Frends.Community.Multipart.SendMultipartRequest/SendMultipartRequest.cs
+++ b/Frends.Community.Multipart.SendMultipartRequest/SendMultipartRequest.cs
@@ -67,7 +67,13 @@ public static async Task SendMultipartRequest(
foreach (var text in input.TextData)
{
cancellationToken.ThrowIfCancellationRequested();
- request.AddParameter(text.Key, text.Value, ParameterType.GetOrPost);
+ if (text.ContentType.ToString() == "JSON")
+ {
+ BodyParameter bodyParameter = new BodyParameter(text.Key, text.Value, "application/json");
+ request.AddParameter(bodyParameter);
+ }
+ else
+ request.AddParameter(text.Key, text.Value, ParameterType.GetOrPost);
}
foreach (var header in input.Headers)
diff --git a/README.md b/README.md
index 05610ac..7c563f5 100644
--- a/README.md
+++ b/README.md
@@ -26,13 +26,13 @@ A frends task for sending multipart/form-data requests.
### Input
-| Property | Type | Description | Example |
-|-----------|---------------------------------------------------------|-------------------------------------------------------------------------------------------------------|-------------------------------------------------------|
-| Method | `Enum` | HTTP method which should be used for the multipart/form-data request. | `POST` |
-| Url | `string` | Target URL. | `https://httpbin.org/post` |
-| FilePaths | `Array(Object)` | List of files which will be sent to the target server. | `FileParameterKey = file, FullPath = C:\tmp\test.txt` |
-| Headers | `Array(Object)` | List of headers for the request. No need to add Content-Type, since it is always multipart/form-data. | `Name = Accept, Value = application/json` |
-| TextData | `Array(Object)` | List of custom parameters for the request. | `Key = channel, Value = G01QH4ES8SY` |
+| Property | Type | Description | Example |
+|-----------|-------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|------------------------------------------------------------|
+| Method | `Enum` | HTTP method which should be used for the multipart/form-data request. | `POST` |
+| Url | `string` | Target URL. | `https://httpbin.org/post` |
+| FilePaths | `Array(Object)` | List of files which will be sent to the target server. | `FileParameterKey = file, FullPath = C:\tmp\test.txt` |
+| Headers | `Array(Object)` | List of headers for the request. No need to add Content-Type, since it is always multipart/form-data. | `Name = Accept, Value = application/json` |
+| TextData | `Array(Object>)` | List of custom parameters for the request. | `Key = channel, Value = G01QH4ES8SY, ContentType = String` |
### Options
@@ -100,3 +100,4 @@ NOTE: Be sure to merge the latest from "upstream" before making a pull request!
| 1.1.0 | Fixed error message and added param ThrowExceptionOnErrorResponse |
| 1.2.0 | Added option to select which file parameter key will be used. Changed timeout from double to int for UI improvement. |
| 1.3.0 | Added option to select which HTTP method should be used for the request. |
+| 1.4.0 | Added support for application/json data in Text data. |