如何使用带有POST请求的ServiceStack Route使用可选的int参数?

时间:2015-09-02 11:33:45

标签: c# servicestack

这很好用,我可以省略Speed参数:

[Route("/speech/sentence/", "POST")]
public class Sentence : IReturn<HttpResult>
{
    public string Input { get; set; }
    public string Speed { get; set; }
}

这不起作用,得到一个&#39; HTTP / 1.1 400错误请求&#39;无法省略Speed参数:

[Route("/speech/sentence/", "POST")]
public class Sentence : IReturn<HttpResult>
{
    public string Input { get; set; }
    public int    Speed { get; set; }
}

这也不起作用,得到一个&#39; HTTP / 1.1 400 Bad Request&#39;无法省略Speed参数:

[Route("/speech/sentence/", "POST")]
public class Sentence : IReturn<HttpResult>
{
    public string Input { get; set; }
    public int?    Speed { get; set; }
}

任何? 感谢

0 个答案:

没有答案