title: Bad Request (400) for POST request to ASP.NET Core 6, minimal API, sent from Postman
body: <p>why I get 400 bad request when testing ASP.NET CORE minimal API app with Postman?</p>
  <p>Default VS 2022 ASP.NET core minimal API project, with following method handler:</p>
  <pre><code>app.MapPost(&quot;/test&quot;, (AnalizeSentenceRequest r) =&gt;
  {
      return Results.Ok($&quot;Echo: {r.Sentence}&quot;);
  });
  </code></pre>
  <p>DTO:</p>
  <pre><code>public class AnalizeSentenceRequest
  {
      public string? Sentence { get; set; }
  }
  </code></pre>
  <p>Windows 10 or Ubuntu curls works fine:</p>
  <pre><code>&gt; curl -X POST http://localhost:5050/test -H &quot;Content-Type: application/json&quot; -d &quot;{\&quot;sentence\&quot;:\&quot;testing\&quot;}&quot;
  </code></pre>
  <p>response:</p>
  <blockquote>
  <p>&quot;Echo: testing&quot;</p>
  </blockquote>
  <p>But Postman gets 400:</p>
  <p><a href="https://i.stack.imgur.com/7YI6G.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7YI6G.png" alt="enter image description here" /></a></p>
  <p>Postman headers:</p>
  <p><a href="https://i.stack.imgur.com/vn5Cx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vn5Cx.png" alt="enter image description here" /></a></p>
  <p>Edit: Postman response:</p>
  <p>It complains that it cannot bind to DTO <strong>AnalizeSentenceRequest r</strong></p>
  <p>I tried to add [FromBody] attribute to the handler:</p>
  <pre><code>([FromBody] AnalizeSentenceRequest r) =&gt; ...
  </code></pre>
  <p>but it makes no difference.</p>
  <p>It works with curl though... So it looks like Postman is messing up with the body, but what it might be?</p>
  <p>Full response:</p>
  <pre><code>Microsoft.AspNetCore.Http.BadHttpRequestException: Required parameter &quot;AnalizeSentenceRequest r&quot; was not provided from body.
     at Microsoft.AspNetCore.Http.RequestDelegateFactory.Log.RequiredParameterNotProvided(HttpContext httpContext, String parameterTypeName, String parameterName, String source, Boolean shouldThrow)
     at lambda_method1(Closure , Object , HttpContext , Object )
     at Microsoft.AspNetCore.Http.RequestDelegateFactory.&lt;&gt;c__DisplayClass46_3.&lt;&lt;HandleRequestBodyAndCompileRequestDelegate&gt;b__2&gt;d.MoveNext()
  --- End of stack trace from previous location ---
     at Microsoft.AspNetCore.Routing.EndpointMiddleware.&lt;Invoke&gt;g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
     at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
     at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
     at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
  
  HEADERS
  =======
  Accept: */*
  Host: localhost:5050
  Content-Type: application/json
  </code></pre>