• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

noamt/rest-gradle-plugin: A Gradle plugin that provides a REST request task infr ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

noamt/rest-gradle-plugin

开源软件地址(OpenSource Url):

https://github.com/noamt/rest-gradle-plugin

开源编程语言(OpenSource Language):

Groovy 100.0%

开源软件介绍(OpenSource Introduction):

REST Gradle Plugin

A Gradle plugin that provides a task infrastructure to perform REST requests

Installation

Build Status

See the Gradle Plugin Portal for installation instructions.

Usage

The plugin adds a new task named rest. This task exposes the following properties
  • httpMethod - The type of HTTP method to execute. Type: String. Default: get. Possible values: delete, get, head, options, post, put.

  • uri - The target URI of the request. An invocation of toString() on the value should result in a valid URI. Type: Object.

  • username - Authentication username. Type: String.

  • password - Authentication password. Type: String.

  • contentType - The expected content type of both request and response. Type: groovyx.net.http.ContentType / String.

  • requestContentType - The expected content type of the request. Overrides the contentType parameter. Type: groovyx.net.http.ContentType / String.

  • requestBody - The request content. Type: Object.

  • requestHeaders - Additional request headers. Type: Map.

  • responseHandler - A custom successful request handler. Type: groovy.lang.Closure. The closure accepts one parameter. May accept the types String, InputStream or Object which falls back to the client’s default handler.

For example, a POST request task:

task attack(type: org._10ne.gradle.rest.RestTask) {
    httpMethod = 'post'
    uri = 'https://battle.server.com/attack'
    username = 'player'
    password = 'password'
    requestBody = [battleCry: 'FOR LEEROY JENKINS!']
    contentType = groovyx.net.http.ContentType.JSON
    requestHeaders = [customHeader: 'WoW']
    responseHandler = {
        //Configured content type is JSON and we let the client's handler parse the response for us
        assert it.message == 'success'
    }
}



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
lizhangqu/AndroidGradlePluginCodeViewer发布时间:2022-06-11
下一篇:
sxfad/gradle-scripts: 简化Gradle 配置, Gradle文件标准化发布时间:2022-06-11
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap