Search code examples
jsonapimodel-view-controllerhttp-headerscontent-type

Unable to debug Content-Type request header of incoming webrequest


I'm testing my application with Postman and while testing I've added multiple headers:

enter image description here

These headers I recieve in my API and I'm able to only debug my custom headers "loggedInUser" and "AuthorisationKey". I'm doing this with the following code:

loggedInUser = int.Parse(this.ActionContext.Request.Headers.GetValues("loggedInUser").First());
providedAuthKey = this.ActionContext.Request.Headers.GetValues("AuthorisationKey").First();

However I cant find the header "Content-Type" in my ActionContext, I've tried the following:

var requestedDatatype = this.ActionContext.Request.Headers.GetValues("Content-Type").First();
var requestedDatatype = this.Request.Content.Headers.ContentType;

Does anyone know how to do this?

Thanks in advance!


Solution

  • Authorization can handle it, check this out man https://learning.getpostman.com/docs/postman/sending_api_requests/authorization/