Sign inSign up

jakubstas/pretty-curl

By jakubstas

•Updated about 10 years ago

Simple container pretty-printing curl outputs.

Image
2

10K+

jakubstas/pretty-curl repository overview

⁠Pretty cURL

Using pretty-printed curl outputs is useful for many different purposes ranging from dev testing all the way to customer demos. This image aims to provide the tools necessary to achieve just that.

⁠How to use this image

The basic premise is to chain the following three commands:

  • curl
  • json_pp / xml_pp
  • pygmentize

⁠Run the image

docker run -it jakubstas/pretty-curl

For adhoc testing, just chain the command manually like this:

⁠JSON example
curl -gX GET http://localhost:8080/Spring4WithSwagger/rest/users | \
        json_pp | \
        pygmentize -l json

 

producing this output:

pretty-curl-json-demo

⁠XML example
curl -gX GET http://localhost:8080/Spring4WithSwagger/rest/products | \
        xml_pp | \
        pygmentize -l xml

 

producing this output:

pretty-curl-xml-demo

⁠Custom functions

To save some additional typing, you can utilize bash functions available in the image (producing the same results).

⁠JSON example - jcurl
jcurl -gX GET http://localhost:8080/Spring4WithSwagger/rest/users

 

⁠XML example - xcurl
xcurl -gX GET http://localhost:8080/Spring4WithSwagger/rest/products

 

⁠Testing applications deployed in host system

In case the application you want to query runs in your host operating system, just issue the following command. Such a container will share the network stack with the docker host and from the container point of view, localhost (or 127.0.0.1) will refer to the docker host.

docker run -it --net="host" jakubstas/pretty-curl

 

⁠Testing applications behind a proxy

In case you are test the application from behind a proxy, just issue the following command.

docker run -it \
            -e "http_proxy=http://<username>:<password>@<host>:<port>" \
            -e "https_proxy=https://<username>:<password>@<host>:<port>" \
            jakubstas/pretty-curl

 

Application used to test this image can be found on my personal GitHub.

github-link

Tag summary

Content type

Image

Digest

Size

151 MB

Last updated

about 10 years ago

docker pull jakubstas/pretty-curl