workcontrolgit/TemplateOnionAPI

Not return HTTP Status code 201 when POST

Opened this issue · 4 comments

The status code is returned as 200 after successful post. It should be 201.

The fix is included in v 1.3.3

    [HttpPost]
    [ProducesResponseType(StatusCodes.Status201Created)]
    [ProducesResponseType(StatusCodes.Status400BadRequest)]
    // [Authorize]

    public async Task<IActionResult> Post(CreatePositionCommand command)
    {
        var resp = await Mediator.Send(command);
        return CreatedAtAction(nameof(Post), resp);
    }

@workcontrolgit that should be CreatedAtAction(nameof(Get), new { Id = resp }, resp);