Giter Site home page Giter Site logo

fg-net's Introduction

FG-Net: Easy HTTP Client for Groovy (and Java of course)

Project is under rebuild. It’s a hard fork of original HttpBuilder-NG

Version 1.* is fully compatible with original project HttpBuilder-NG but on upgraded stack. I.e. supports Groovy 4.* and is built with Java 17.

Quick Overview

This is a modern Groovy DSL for making http requests. It is built against Groovy 4.x, but it doesn’t make any assumptions about which version of Groovy you are using (if they are compatible). The main goal of the client 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 the client works. It 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.

Artifacts

The latest version: Artifact Version

FG-Net artifacts are available on Maven Central, for Gradle you can add the following dependency to your build.gradle file dependencies closure:

implementation 'com.ainrif.fg-net:core:<version>'

or, for Maven add the following to your pom.xml file:

<dependency>
  <groupId>com.ainrif.fg-net</groupId>
  <artifactId>core</artifactId>
  <version>(version)</version>
</dependency>
Note
You can replace core with apache-provider and will be able to build clients this Apache Http Client.

DevOps

Build Instructions

HttpBuilder-NG is built using gradle. To perform a complete build run the following:

./gradlew clean build

Publish

  • configure ~/.gradle/gradle.properties and import Ainrif General GPG.

  • call ./gradlew clean build publishToSonatype closeAndReleaseSonatypeStagingRepository to release lib.

  • tag release commit with version git tag <version from build.gradle> && git push --tags

Documentation

Note
TODO TBA

fg-net's People

Contributors

cjstehno avatar dwclark avatar jgritman avatar katoquro avatar adamhurwitz avatar jageay avatar szpak avatar rdmueller avatar sparsick avatar aalmiray avatar dfernandez79 avatar wheelerlaw avatar spoonman avatar mbabineau avatar stlhrt avatar kgeis avatar kamilszymanski avatar jlafourc avatar jagedn avatar splix avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.