Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hyperrest-bin

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperrest-bin

A simple HTTP service with controlled behaviour

  • 0.2.1
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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

Usage

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

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

                                                                                      # ORIGINATING IP
                                                                                      # see response

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

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

                                                                                      # PREFER (as per extensions of preferences)
curl -H"X-Prefer: cookie=name1|v, cookie=name2|v"             http://127.0.0.1:1337   # set cookies "name1" and "name2"
curl -H"X-Prefer: cookie=name1"                               http://127.0.0.1:1337   # 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"}, \
         "body":"TEXT"
        }'                                                    http://127.0.0.1:1337   # return 200, etc.


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

License

Apache 2.0.

Keywords

FAQs

Package last updated on 24 Oct 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc