A simple HTTP service with controlled behaviour

npm install hyperrest-bin
14 downloads in the last week
28 downloads in the last month

HyperREST bin

A simple HTTP service with controlled behaviour, inspired by httpbin.

The service makes use of HTTP headers, and predominantly X-Prefer, in order to allow the client to control server behaviour.

Additionaly it also makes use of know-your-http-well and acts as a bookmarking tool for specification of HTTP status codes, headers, methods and relations.

This project is live at bin.hyperrest.com and has a search engine for convenience.

Install & run

npm install hyperrest-bin
hyperrest-bin                                                                         # or PORT=1337 hyperrest-bin


curl                                                   # README.md
curl                                                * # README.md on any path
curl -XPOST                                            # README.md
curl -XPOST -H"Accept: application/json"               # JSON TRACE
curl -XPOST -H"Accept: application/xml"                # XML TRACE

                                                                                      # TRACE, METHOD OVERRIDE
curl -XTRACE                                           # message/http TRACE
curl -XPOST  -H"X-HTTP-Method-Override: TRACE"         # message/http TRACE still
curl -XTRACE -H"Accept: application/json"              # JSON TRACE
curl -XTRACE -H"Accept: application/xml"               # XML TRACE

                                                                                      # ORIGINATING IP
                                                                                      # see response

                                                                                      # GZIP/DEFLATE
curl -H"Accept-Encoding: gzip,deflate"                 # GZIP README.md

                                                                                      # PREFER (as per registered preferences)
curl -H"X-Prefer: status=404"                          # 404 Not Found
curl -H"X-Prefer: wait=10"                             # wait 10 seconds, then README.md
curl -H"X-Prefer: return-minimal"                      # 200 OK, but no README.md
curl -H"X-Prefer: return-representation" -H"Accept:text/html"   # return README.md by force

                                                                                      # PREFER (as per extensions of preferences)
curl -H"X-Prefer: cookie=name1|v, cookie=name2|v"      # set cookies "name1" and "name2"
curl -H"X-Prefer: cookie=name1"                        # delete cookie "name1"

                                                                                      # PREFER response as defined in the request body
curl -XPOST \
     -H"Content-Type: application/json" \
     -H"X-Prefer: return-request" \
     -d'{"status":"200", \
         "headers":{"Content-Type":"text/plain"}, \
        }'                                             # return 200, etc.

                                              # https://github.com/andreineculau/know-your-http-well
curl{value}     # Specification for HTTP Status Code
curl{value}     # Specification for HTTP Header
curl{value} # Specification for HTTP Method
curl{value}        # Specification for HTTP Relation
curl{value}       # Specification for HTTP AnyOfTheAbove (I feel lucky mode)


Apache 2.0.

npm loves you