diff --git a/src/Simplify.Web/ControllerBase.cs b/src/Simplify.Web/ControllerBase.cs index f870d794..2980ae92 100644 --- a/src/Simplify.Web/ControllerBase.cs +++ b/src/Simplify.Web/ControllerBase.cs @@ -38,6 +38,13 @@ public abstract class ControllerBase : ActionModulesAccessor /// The status code. protected Content Content(string content, string contentType, int statusCode = 200) => new(content, contentType, statusCode); + /// + /// Initializes a new instance of the class. + /// + /// The string content. + /// Type of the content. + protected Created Created(string content, string contentType = "text/plain") => new(content, contentType); + /// /// Initializes a new instance of the class. /// diff --git a/src/Simplify.Web/Responses/Created.cs b/src/Simplify.Web/Responses/Created.cs new file mode 100644 index 00000000..10d13244 --- /dev/null +++ b/src/Simplify.Web/Responses/Created.cs @@ -0,0 +1,16 @@ +namespace Simplify.Web.Responses; + +/// +/// Provides Creted controller string response with 201 HTTP Status Code +/// +public class Created : Content +{ + /// + /// Initializes a new instance of the class. + /// + /// The string content. + /// Type of the content. + public Created(string content, string contentType = "text/plain") : base(content, 201, contentType) + { + } +} \ No newline at end of file