【问题标题】:Can't set the content-type to Json in functional test无法在功能测试中将内容类型设置为 Json
【发布时间】:2011-08-27 22:54:33
【问题描述】:

我有以下代码发出 json 请求,但它失败了:

Response response = POST("/b/profile/","application/json",body);

我也试过这个:

Response response = POST("/b/profile/","application/x-www-form-urlencoded",body);

但响应再次具有内容类型text/html。有什么想法吗?

【问题讨论】:

  • 错误是什么?堆栈跟踪?

标签: json playframework functional-testing


【解决方案1】:

试试

Response response = POST("/b/profile/","text/javascript",body);

详情请见here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-04-03
    • 2011-08-12
    • 2018-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-28
    相关资源
    最近更新 更多