Skip to content
An HTTP Request snippet generator for Springfox
Branch: master
Clone or download
Latest commit b483512 Mar 17, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
httpsnippet-demo Clean code Mar 17, 2019
httpsnippet Clean code Mar 17, 2019
images Added demo Mar 6, 2019
.gitignore Added bak file to gitignore and formated pom Mar 12, 2019
LICENSE Initial commit Mar 3, 2019
lombok.config initial source Mar 3, 2019
pom.xml Added plugins Mar 13, 2019

HTTP Snippet

HTTP Snippet port for java. See the original node port. Supports many languages & tools including: cURL, HTTPie, Javascript, Node, C, Java, PHP, Objective-C, Swift, Python, Ruby, C#, Go, OCaml and more!

The motivation behind porting this is using it for generating snippets in swagger and redocs. The project is still in development phase.

  • Documentation
  • Tests
  • Releasing to maven


Enable maven snapshots in ~/.m2/settings.xml


Then add this dependency to pom.xml


Here is the code for generating snippet

public class Main {
     public static void main(String[] args) throws Exception {
         List<HarHeader> headers = new ArrayList<>();
         List<HarQueryString> queryStrings = new ArrayList<>();
         User user = new User();
         Faker faker = new Faker();
         HarPostData harPostData =
                 new HarPostDataBuilder()
         HarRequest harRequest =
                 new HarRequestBuilder()
         //Using default client
         HttpSnippet httpSnippet = new HttpSnippetCodeGenerator().snippet(harRequest, Language.JAVA);
         //Or directly using
         String code   = new OkHttp().code(harRequest);
     static class User {
         private String firstName;
         private String lastName;

The result

HttpResponse<String> response = Unirest.get("http://localhost:5000/users")

Running the demo application

mvn clean install
java -jar httpsnippet-demo/target/httpsnippet-demo-0.0.1-SNAPSHOT.jar

After running the demo here are the results

Alt text

Alt text


Apache 2.0 © atkawa7

You can’t perform that action at this time.