I have a very simple starter api using FastEndpoints for this issue.
I want to do a Post and use query parameters to bind to the DTO. I keep getting 415 Unsupported Media Type no matter what.
If I change it to GET, everything works just fine.
What am I doing wrong?
Here is the code:
using FastEndpoints;
using Microsoft.AspNetCore.Http.HttpResults;
namespace PrintService.WebApi2.Endpoints.Epson;
public class PrintRequest
{
[QueryParam]
public string connectionType { get; set; } = string.Empty;
}
public class GetPrintRequest : Endpoint<PrintRequest, string>
{
public override void Configure()
{
Post("/api/printrequest");
AllowAnonymous(); //no security for now
}
public override async Task HandleAsync(PrintRequest req, CancellationToken ct)
{
await SendAsync(req.connectionType, 200, ct);
}
}
Again, if I change this to GET, it works just fine.
Hello,
I have a very simple starter api using FastEndpoints for this issue.
I want to do a Post and use query parameters to bind to the DTO. I keep getting 415 Unsupported Media Type no matter what.
If I change it to GET, everything works just fine.
What am I doing wrong?
Here is the code:
Again, if I change this to GET, it works just fine.