休息生成器客户端发布请求头问题的Grails [英] Rest Builder Client post request with header issue grails

查看:170
本文介绍了休息生成器客户端发布请求头问题的Grails的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我们有以下代码:

  RestBuilder rest = new RestBuilder()
rest = rest.post(https://api..com/ff/one){
header'x-pushbots-appid ','550de488b4569'
header'x-pushbots-secret','e6717aea77d'
contentTypeapplication / json
json {
token =APA91bG9rUbBPURYejC1uzDLbqUMaeHulCtBNIYUokqV5QUwelLygKi8c5c2kD2lq05DXiiKJEDgH8NGfM6DFGhCETgSuX5kOr
平台=1
msg =来自API调用的sarath测试
sound =ding
badge =badge
payload =JSON
}

Postman对此请求给出正确的结果,同时使用rest client builder插件,回应为空。
我检查过api文档,代码看起来很好。

解决方案

看来我是json builder的错误版本。
在使用编译:rest-client-builder:2.1.1后,问题得到修复


I am trying post request with rest client builder.

We have following code

RestBuilder rest = new RestBuilder()
rest = rest.post("https://api..com/ff/one"){
    header 'x-pushbots-appid', '550de488b4569'
    header 'x-pushbots-secret', 'e6717aea77d'
    contentType "application/json"
    json {
        token ="APA91bG9rUbBPURYejC1uzDLbqUMaeHulCtBNIYUokqV5QUwelLygKi8c5c2kD2lq05DXiiKJEDgH8NGfM6DFGhCETgSuX5kOr"
        platform="1"
        msg ="sarath test from API call"
        sound ="ding"
        badge ="badge"
        payload ="JSON"
    }
}

Postman is giving correct result for this request , while using rest client builder plugin, response is coming as null. I checked in api doc and code looks fine.

解决方案

it seems i was wrong version of json builder. Issue got fixed after using compile ":rest-client-builder:2.1.1"

这篇关于休息生成器客户端发布请求头问题的Grails的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆