使用Fiddler测试ServiceStack

时间:2011-11-08 11:04:12

标签: fiddler servicestack

我根据以下链接使用ServiceStack(客户示例)构建了一项服务:https://docs.google.com/present/view?id=dg3mcfb_213gsvvmmfk

当我按照以下方式使用它时,效果很好:

JsonServiceClient client = new JsonServiceClient("http://localhost/RestIntro");

Customer c = new Customer();
c.Name = "myname";
c.Age = 24;
c.Email = "myemail";

var res = client.Post<Customer>("/customers", c);

并将客户插入数据库。

但是当我使用Fiddler(POST请求)对其进行测试时,它会给出201状态消息(已创建)但数据库字段仍为空,如下图所示:

Post request using fiddler database status

可能是我的问题?

1 个答案:

答案 0 :(得分:4)

更改请求标头:

User-Agent: Fiddler
Host: localhost
Content-Length: 44
Content-Type: application/json