【问题标题】:Test jsonp rest app response using httpbuilder使用 httpbuilder 测试 jsonp rest app 响应
【发布时间】:2011-04-26 08:56:14
【问题描述】:

嗨 我正在尝试建立一个提供 JSON 响应的休息服务。 昨天我想知道什么是 JSONP,为什么要使用它。 今天我想用我的新版本的服务做一些测试。 为了测试它,我使用 HTTPbuilder。但我无法让它正常工作。 这是我的测试的开始:

 def client = new RESTClient("http://localhost:"+SERVER_PORT)
 def resp = client.get(path:'/music', contentType:JSON);

这是我得到的错误:

ATTENTION: Error parsing 'application/javascript' response
 net.sf.json.JSONException: Invalid JSON String

如何帮助 httpbuilder 理解响应是 JS 回调?

【问题讨论】:

    标签: json rest jsonp httpbuilder


    【解决方案1】:

    好吧,我对这个有点傻。 接受的内容类型必须是 ContentType.ANy

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-09
      • 2014-07-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-25
      相关资源
      最近更新 更多