Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
io.github.http-builder-ng:http-builder-ng-okhttp
Advanced tools
Groovy client for making http requests.
Http Builder NG is a modern Groovy DSL for making http requests. It requires Java 8 and a modern Groovy. It is built against Groovy 2.4.x, but it doesn't make any assumptions about which version of Groovy you are using. The main goal of Http Builder NG is to allow you to make http requests in a natural and readable way. For example:
//let's configure an http client to make calls to httpbin.org using the default http library
def httpBin = HttpBuilder.configure {
request.uri = 'http://httpbin.org/'
}
//now let's GET /get endpoint at httpbin.
//This will return a JSON formatted response with an origin property.
def result = httpBin.get {
request.uri.path = '/get'
}
println("Your ip address is: ${result.origin}")
//Finally lets post a standard http form to httpbin
httpBin.post {
request.uri.path = '/post'
request.body = [ input1: 'the first input', input2: 'the second input' ]
request.contentType = 'application/x-www-form-urlencoded'
}
Hopefully that gives you a general idea of how Http Builder NG works. Http Builder NG is designed to be compatible with Groovy code annotated with @TypeChecked and @CompileStatic. It also makes use of the @DelegatesTo to provide better IDE support when writing code using Http Builder NG.
Http Builder NG artifacts are available on Bintray and Maven Central, for Gradle you can add the following dependency to your build.gradle
file dependencies
closure:
compile 'io.github.http-builder-ng:http-builder-ng-CLIENT:1.0.4'
or, for Maven add the following to your pom.xml
file:
<dependency>
<groupId>io.github.http-builder-ng</groupId>
<artifactId>http-builder-ng-CLIENT</artifactId>
<version>1.0.4</version>
</dependency>
where CLIENT
is replaced with the client library name (core
, apache
, or okhttp
).
HttpBuilder-NG is built using gradle. To perform a complete build run the following:
`./gradlew clean build`
Test reports are not automatically generated; if you need a generated test report (aggregated or per-project) use:
`./gradlew clean build jacocoTestReport aggregateCoverage`
Note that the aggregateCoverage
task may be dropped if the aggregated report is not desired. The reports will be generated in their respective build/reports
directories, with the aggregated report being in the build
directory of the project root.
You can also generate the documentation using one of the following commands:
./gradlew aggregateJavaDoc
./gradlew asciidoctor
Overall project documentation may also be generated as the project web site, using the site
task, discussed in the next section.
The documentation for the project consists of:
src/site
directory).src/docs/asciidoc
directory).The documentation is provided by a unified documentation web site, which can be generated using:
./gradlew site
This task uses the com.stehno.gradle.site plugin to aggregate all the documentation sources and generate the project web site. Once it is built, you can verify the generated content by running a local server:
./gradlew startPreview
which will start a preview server (see com.stehno.gradle.webpreview) on a random port copied to your clipboard.
To stop the preview server run:
./gradlew stopPreview`
Once you are ready to publish your site, simply run the following task:
./gradlew publishSite
This task will push the site contents into the gh-pages
branch of the project, assuming you have permissions to push content into the repo.
When ready to release a new version of the project, perform the following steps starting in the development
branch:
build.gradle
) has been updated to the desired version../gradlew updateVersion -Pfrom=OLD_VERSION
to update the documented version.development
to master
and accept it or have it reviewed.Once the pull request has been merged into master
, checkout the master
branch and:
./gradlew release
which will check the documented project version against the project version, publish the artifact and the documentation web site.
HOME/.gradle/gradle.properties
file):
user
- the Bintray usernamekey
- the Bintray key/passwordsonotypeUser
- the Sonotype username (from API key)sonotypePass
- the Sonotype password (from API key)./gradlew verifyRelease
to ensure that the artifacts and site have been published (optional but recommended).The development
branch may now be used for the next round of development work.
NOTE: Since the artifacts must be confirmed and the site may need some installation time, the
verifyRelease
task cannot be combined with therelease
task.
When updating the version of the project, the documented version should also be updated using the updateVersion
task. Modify the version in the project build.gradle
file and make note of the existing version then run:
./gradlew updateVersion -Pfrom=OLD_VERSION
where OLD_VERSION
is the pre-existing version of the project. This will update the current version mentioned in the documentation (e.g. README, User Guide and site).
Http Builder NG was forked from the HTTPBuilder project originally developed by Thomas Nichols. It was later passed on to Jason Gritman who maintained it for several years.
The original intent of Http Builder NG was to fix a few bugs and add a slight enhancement to the original HTTPBuilder project. The slight enhancement was to make HTTPBuilder conform to more modern Groovy DSL designs. However, it was not possible to update the original code to have a more modern typesafe DSL while preserving backwards compatibility. I decided to just make a clean break and give the project a new name to make it clear that Http Builder NG is basically a complete re-write and re-architecture.
Copyright 2017 HttpBuilder-Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
FAQs
Groovy client for making http requests.
We found that io.github.http-builder-ng:http-builder-ng-okhttp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.