Quantcast
Viewing all articles
Browse latest Browse all 3667

Creating REST API with custom "x-myvalue" in header

Super simple ApiController:

[ApiController][Route("[controller]")]public class MyController : ControllerBase{  [HttpPost]  public IActionResult DoStuff([FromHeader] string X-SomeValue)  {     return Ok();  }}

This does not compile, as X-SomeValue is not a valid parameter name.The easiest is just call it XSomeValue, but AFAIK best practise is use X-.

How can I use X-SomeValue in the header?


Viewing all articles
Browse latest Browse all 3667

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>