1
一个供应商的API我需要使用在发送与内容类型的POST请求:文本/无格式和JSON在体内。.NET 1.0核心网络API处理请求体作为JSON当内容类型是文本/无格式
如何解析它在.NET 1.0核心API的网站?
我敢肯定,我需要做类似this(下面的代码)回答的东西,但我不知道如何在网页API。
public class RawContentTypeMapper : WebContentTypeMapper
{
public override WebContentFormat GetMessageFormatForContentType(string contentType)
{
switch (contentType.ToLowerInvariant())
{
case "text/plain":
case "application/json":
return WebContentFormat.Json;
case "application/xml":
return WebContentFormat.Xml;
default:
return WebContentFormat.Default;
}
}
}