Amido.Testing.WebApi.WebApiRequest.AddContentType C# (CSharp) Method

AddContentType() public method

Helper method for adding a content type to the request.
public AddContentType ( ContentType contentType ) : WebApiRequest
contentType ContentType The .
return WebApiRequest
        public WebApiRequest AddContentType(ContentType contentType)
        {
            string contentTypeString;
            switch (contentType)
            {
                case ContentType.Json:
                    contentTypeString = "application/json";
                    break;
                case ContentType.Xml:
                    contentTypeString = "text/xml";
                    break;
                default:
                    contentTypeString = "application/x-www-form-urlencoded";
                    break;
            }

            headers.Add("Content-Type", contentTypeString);
            return this;
        }