title: Curl 415 Unsupported Media Type
body: <p>I am trying to test my endpoint with curl and getting a 415:</p>
  
  <pre><code>curl -X POST "http://localhost:5001/api/countries/import" \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer "$API_TOKEN \
  --data @/D:/_countries.json
  </code></pre>
  
  <p>Response:</p>
  
  <pre><code>{"type":"https://tools.ietf.org/html/rfc7231#section-6.5.13","title":"Unsupported Media Type","status":415,"traceId":"0HLTFOME7T990:00000001"}
  </code></pre>
  
  <p>And here's my .net core endpoint:</p>
  
  <pre><code>// POST api/countries/import
  [HttpPost]
  [Route("[action]")]
  public async Task&lt;IActionResult&gt; Import(IFormFile file)
  {
      ...
  }
  </code></pre>
  
  <p>Btw, I have no problem with this endpoint in postman although it's generated code doesn't work for me (the response is the same):</p>
  
  <pre><code>curl --location --request POST 'http://localhost:5001/api/countries/import' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer {token here}' \
  --form 'file=@/D:/_countries.json'
  </code></pre>
  
  <p>P.S. I am using Windows 10 and git bash to run the script.</p>