ServiceStack补丁不反序列化json

时间:2014-02-12 08:43:25

标签: servicestack

我正在尝试添加重命名实体的功能,基本上它适用于Post但不适用于我想要的Patch。这是我的请求DTO的样子:

[Route("/UpdateArea/{AreaID}")]
public class UpdateArea : IReturn<Area>
{
    public int AreaID { get; set; }
    public string Name { get; set; }
}

使用Post时,我在请求DTO中同时获得AreaID和Name,但在使用Patch时,我只获得AreaID(Name为null)。两个请求在Fiddler中看起来都是一样的,除了顶部的动词发生了变化:

POST http://localhost:51690/api/UpdateArea/9 HTTP/1.1
Accept: application/json, text/javascript, */*; q=0.01
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Referer: http://localhost:51690/Default.aspx
Accept-Language: en-US
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Host: localhost:51690
Content-Length: 8
DNT: 1
Connection: Keep-Alive
Pragma: no-cache
Cookie: ASP.NET_SessionId=qg1xabozws2hdvpd5ynhcpiv; proxy=http://localhost:16918/proxy/0/

Name=aaa

使用ServiceStack 4.0.9

0 个答案:

没有答案