Enterprise Integration Zone is brought to you in partnership with:

Lorna Jane Mitchell is a PHP developer, blogger, trainer and evangelist from Leeds in the UK. She is active with phpwomen.org and her local user group PHP North West, and writes for a variety of outlets, including her own blog at lornajane.net. She is an active member of the PHP and open source communities and contributes to the joind.in event feedback project. When she's not at her computer, Lorna enjoys yarn craft, hobby electronics, and her home renovation project. Lorna is a DZone MVB and is not an employee of DZone and has posted 77 posts at DZone. You can read more from them at their website. View Full User Profile

Endpoints for HTTP Testing

02.12.2013
| 3535 views |
  • submit to reddit
While working on a book ("PHP Web Services" from O'Reilly, not out yet but soon!) recently, I was looking for some place I could make HTTP requests to, to show off how to make different kinds of requests with different tools. On my own machine, I have a couple of scripts that chatter back giving debug information about the requests that were made, but I wanted to get the tools examples going without any additional dependencies at all. I hadn't used anything like these tools before, but I found quite a few alternatives, so I thought I'd share what I came up with.

Example.org, Example.net, Example.com

The least exciting example, but a solid one nonetheless, the "example" domains are reserved exactly so that we can use them in all our various example code without annoying anyone when that code gets copied and pasted. I use these in places where I'm using code from a real project, but removing URLs to protect the innocent.

There's more information about these domains (they have some examples with character encoding in URLs and things also) here: http://www.iana.org/domains/special

Requestb.in

http://requestb.in/

My favourite by far, this got quite a lot of use in the book! The source is available on github as well, so if you need to do in-house testing of any kind then you can make your own copy of this application.

Basically:

  1. Visit the site and create a new "bin"
  2. Make requests to the endpoint you are given
  3. Visit the related view page to view exactly which requests were made, what headers were sent, and so on, all in a pretty graphical setting

requestbin

Respondto.it

http://respondto.it/

This tool is also on github so you can grab, use and adapt it, which is fabulous for developers. It's slightly more advanced than requestb.in because you can configure responses for particular requests, but still shows you great detail on what was sent and received, which is great. I didn't use this much because I was really writing toy code but I can see it being a great tool for API development so I'm filing it for future use.

httpbin

http://httpbin.org/

Perhaps a little less shiny than the others, but much more specific in the way it works. You request to different endpoints, and it returns information about what was in the request, rather than making requests from one tool, and viewing information in a web page. This seems like a perfect tool for testing HTTP clients, for example.

HTTP Testing Endpoints

Having taken the time to get to know some of these tools, I think I'll be using them more in the future rather than the scrappy bits of PHP script that I usually throw together! These endpoints are an easy way for people to test without having to set anything else up, or could even be used for debugging without really knowing what too much about what is going on, for example emailing a requestb.in link with specific query data to check what other headers a client is sending in order to debug a request. There must be plenty of other possibilities too, do you use a tool like this? Leave me a comment!

Published at DZone with permission of Lorna Mitchell, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)