Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/noamt/rest-gradle-plugin
A Gradle plugin that provides a REST request task infrastructure
https://github.com/noamt/rest-gradle-plugin
Last synced: 2 months ago
JSON representation
A Gradle plugin that provides a REST request task infrastructure
- Host: GitHub
- URL: https://github.com/noamt/rest-gradle-plugin
- Owner: noamt
- Created: 2013-02-25T09:16:23.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2016-10-26T11:10:37.000Z (about 8 years ago)
- Last Synced: 2024-08-04T03:02:56.109Z (5 months ago)
- Language: Groovy
- Size: 180 KB
- Stars: 47
- Watchers: 9
- Forks: 17
- Open Issues: 15
-
Metadata Files:
- Readme: README.asciidoc
Awesome Lists containing this project
- awesome-gradle - rest-gradle-plugin - Perform REST requests. (Plugins / Web application development)
README
= REST Gradle Plugin =
== A Gradle plugin that provides a task infrastructure to perform REST requests ==
=== Installation ===
image:https://travis-ci.org/noamt/rest-gradle-plugin.svg?branch=master["Build Status", link="https://travis-ci.org/noamt/rest-gradle-plugin"]
See the http://plugins.gradle.org/plugin/org.tenne.rest[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:
[source,groovy]
----
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'
}
}
----