title: How to make the request body optional
body: <p>I've got the following POST function:</p>
  
  <pre><code>public async Task&lt;BaseResponse&gt; Post([FromBody] BodyParams content)
  {
      var option = content.TopOnly;
      return await RunHttpMethodAsync(option, _worker.Lookup);
  }
  </code></pre>
  
  <p>Here's the BodyParams class:</p>
  
  <pre><code>public class BodyParams
  {
      public bool TopOnly { get; set; }
  }
  </code></pre>
  
  <p>This works as intended. However, I'd like to make <code>BodyParams content</code> as optional, and set <code>TopOnly</code> to <code>true</code> if not provided. I've tried:</p>
  
  <pre><code>public class BodyParams
  {
      public bool TopOnly { get; set; } = true;
  }
  </code></pre>
  
  <p>And then not providing a body, but I get the following return:</p>
  
  <pre><code>{
      "type": "https://tools.ietf.org/html/rfc7231#section-6.5.13",
      "title": "Unsupported Media Type",
      "status": 415,
      "traceId": "00-305034a9723b9a4f94e0601c6ecc3587-b67fe89deb8e644f-00"
  }
  </code></pre>
  
  <p>I put a breakpoint on my <code>var option</code>, and I don't even reach that.</p>
  
  <p>My question is, how can I make the request body optional for POSTs?</p>