Skip to content

Commit

Permalink
[#226] [add] impl
Browse files Browse the repository at this point in the history
  • Loading branch information
i4004 committed Jul 7, 2023
1 parent 4419467 commit 24f6589
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Simplify.Web/ControllerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ public abstract class ControllerBase : ActionModulesAccessor
/// <param name="statusCode">The status code.</param>
protected Content Content(string content, string contentType, int statusCode = 200) => new(content, contentType, statusCode);

/// <summary>
/// Initializes a new instance of the <see cref="Created" /> class.
/// </summary>
/// <param name="content">The string content.</param>
/// <param name="contentType">Type of the content.</param>
protected Created Created(string content, string contentType = "text/plain") => new(content, contentType);

/// <summary>
/// Initializes a new instance of the <see cref="File" /> class.
/// </summary>
Expand Down
16 changes: 16 additions & 0 deletions src/Simplify.Web/Responses/Created.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace Simplify.Web.Responses;

/// <summary>
/// Provides Creted controller string response with 201 HTTP Status Code
/// </summary>
public class Created : Content
{
/// <summary>
/// Initializes a new instance of the <see cref="Created" /> class.
/// </summary>
/// <param name="content">The string content.</param>
/// <param name="contentType">Type of the content.</param>
public Created(string content, string contentType = "text/plain") : base(content, 201, contentType)
{
}
}

0 comments on commit 24f6589

Please sign in to comment.