GroundWork FoxHttp QuickStart - viascom/FoxHttp GitHub Wiki

Dependency

maven

<dependency>
    <groupId>ch.viascom.groundwork</groupId>
    <artifactId>foxhttp</artifactId>
    <version>1.1</version>
</dependency>

gradle

compile 'ch.viascom.groundwork:foxhttp:1.1'

Android

If you use FoxHttp in android make sure you have the jack option enabled. This is needed, because FoxHttp uses Java 8.

android {
    ...
    defaultConfig {
        ...
        jackOptions {
            enabled true
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

If you are using proguard you have to add this to your proguard-rules.pro file:

-keep class ch.viascom.groundwork.** {
    *;
}

How to use

Get-Request with FoxHttp

FoxHttpResponse foxHttpResponse = new FoxHttpRequestBuilder("http://httpbin.org/get").build().execute();
System.out.println(foxHttpResponse.toString(true));

Post-Request with FoxHttp

FoxHttpResponse foxHttpResponse = new FoxHttpRequestBuilder("http://httpbin.org/post", RequestType.POST)
        .setRequestBody(new RequestStringBody("Request-Body", ContentType.DEFAULT_TEXT))
        .build()
        .execute();
System.out.println(foxHttpResponse.toString(true));
⚠️ **GitHub.com Fallback** ⚠️