美文网首页
Ruby RestClient 常用请求(带json post,

Ruby RestClient 常用请求(带json post,

作者: ifree321 | 来源:发表于2019-11-06 11:06 被阅读0次

GET

        res = RestClient::Request.execute(
        method: :get,
        url: ES_SEARCH_URL,
        timeout: 30,
        headers: {params: params}
      )

POST with JSON body

      res = RestClient::Request.execute(
        method: :post,
        url: url,
        timeout: 30,
        payload: json_body,
        headers: {:content_type=>"application/json", :params => params}
      )

Post without JSON body

      res = RestClient::Request.execute(
        method: :post,
        url: url,
        timeout: 30,
        headers: {:content_type=>"application/json", :params => params}
      )

相关文章

网友评论

      本文标题:Ruby RestClient 常用请求(带json post,

      本文链接:https://www.haomeiwen.com/subject/nsxubctx.html