Http Kit

Basic Java tools for HTTP debugging

License

License

Categories

Categories

IDE Development Tools
GroupId

GroupId

com.andreidemus.http-kit
ArtifactId

ArtifactId

http-kit
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

Http Kit
Basic Java tools for HTTP debugging
Project URL

Project URL

https://github.com/andreidemus/http-kit
Source Code Management

Source Code Management

http://github.com/andreidemus/http-kit/tree/master

Download http-kit

How to add to project

<!-- https://jarcasting.com/artifacts/com.andreidemus.http-kit/http-kit/ -->
<dependency>
    <groupId>com.andreidemus.http-kit</groupId>
    <artifactId>http-kit</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.andreidemus.http-kit/http-kit/
implementation 'com.andreidemus.http-kit:http-kit:0.0.1'
// https://jarcasting.com/artifacts/com.andreidemus.http-kit/http-kit/
implementation ("com.andreidemus.http-kit:http-kit:0.0.1")
'com.andreidemus.http-kit:http-kit:jar:0.0.1'
<dependency org="com.andreidemus.http-kit" name="http-kit" rev="0.0.1">
  <artifact name="http-kit" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.andreidemus.http-kit', module='http-kit', version='0.0.1')
)
libraryDependencies += "com.andreidemus.http-kit" % "http-kit" % "0.0.1"
[com.andreidemus.http-kit/http-kit "0.0.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.apache.maven.plugins : maven-compiler-plugin jar 3.6.2

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.hamcrest : hamcrest-all jar 1.3

Project Modules

There are no modules declared in this project.

HTTP Kit

Contains:

  • Requests (a very basic Java HTTP client for humans, inspired by Python's Requests library.)
  • Responses (a very basic Java HTTP server for http clients testing and debugging)

Library is not stable yet, please, use with care

Maven dependency

<dependency>
    <groupId>com.andreidemus.http-kit</groupId>
    <artifactId>http-kit</artifactId>
    <version>0.0.1</version>
</dependency>

Requests

Usage

Example 1

final String responseBody = Requests.get("https://api.github.com/zen").text();
System.out.println(responseBody);
> Speak like a human.

Example 2

final Request request = new Request("http://httpbin.org").path("post")
                                                         .header("Content-Type", "application/json")
                                                         .pathParam("a", 5)
                                                         .body("{\"x\":10}");
final Response response = Requests.post(request);
System.out.println(response);
> Status: 200
Reason: OK
Headers:
{
  X-Processed-Time : [0.000765085220337]
  Server : [meinheld/0.6.1]
  Access-Control-Allow-Origin : [*]
  Access-Control-Allow-Credentials : [true]
  Connection : [keep-alive]
  Content-Length : [444]
  Date : [Thu, 07 Sep 2017 19:05:42 GMT]
  Content-Type : [application/json]
  X-Powered-By : [Flask]
  Via : [1.1 vegur]
}
Body:
{
  "args": {
    "a": "5"
  }, 
  "data": "{\"x\":10}", 
  "files": {}, 
  "form": {}, 
  "headers": {
    "Accept": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2", 
    "Connection": "close", 
    "Content-Length": "8", 
    "Content-Type": "application/json", 
    "Host": "httpbin.org", 
    "User-Agent": "Java/1.8.0_112"
  }, 
  "json": {
    "x": 10
  }, 
  "origin": "178.210.135.192", 
  "url": "http://httpbin.org/post?a=5"
}

Versions

Version
0.0.1