Skip to content

Commit 8db185e

Browse files
authored
Add contentType parameter to RequestBodyAttribute
1 parent 6856689 commit 8db185e

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/Simplify.Web.Swagger/RequestBodyAttribute.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ namespace Simplify.Web.Swagger;
1010
/// Initializes an instance of <see cref="RequestBodyAttribute" />.
1111
/// </remarks>
1212
/// <param name="model">The request body model type.</param>
13+
/// <param name="contentType">The content type associated with the request.</param>
1314
[AttributeUsage(AttributeTargets.Class)]
14-
public class RequestBodyAttribute(Type model) : Attribute
15+
public class RequestBodyAttribute(Type model, string contentType = "application/json") : Attribute
1516
{
1617
/// <summary>
1718
/// Request body model type
@@ -20,4 +21,12 @@ public class RequestBodyAttribute(Type model) : Attribute
2021
/// The model.
2122
/// </value>
2223
public Type Model { get; private set; } = model ?? throw new ArgumentNullException(nameof(model));
23-
}
24+
25+
/// <summary>
26+
/// Gets the type of the content.
27+
/// </summary>
28+
/// <value>
29+
/// The type of the content.
30+
/// </value>
31+
public string ContentType { get; private set; } = contentType;
32+
}

0 commit comments

Comments
 (0)