

HTTP responses as a service - hondo522
http://mock.isssues.com

======
philjackson
I have a confession to make. I just spent three minutes trying to work out why
[http://mock.isssues.com/400](http://mock.isssues.com/400) was returning bad
request behind ApiAxle...

------
patjoh
I'm been using [http://httpbin.org/](http://httpbin.org/) for this.

~~~
izuzak
Yep. Also:

[http://www.mocky.io/](http://www.mocky.io/),
[http://ivanzuzak.info/urlecho/](http://ivanzuzak.info/urlecho/), and in some
cases: [http://hang.nodester.com/](http://hang.nodester.com/)

~~~
diminoten
Oh my goodness, I've been looking for this (mocky) for weeks! Thank you. There
really isn't much by way of this particular service, and I found it immensely
valuable when I used it last.

------
nwh
No 451 response?

[https://tools.ietf.org/html/draft-tbray-http-legally-
restric...](https://tools.ietf.org/html/draft-tbray-http-legally-restricted-
status-00)

~~~
cbsmith
Yup, sent the author a note on that.

------
stevekemp
The last time I used something like this it was
[http://httpstat.us/](http://httpstat.us/)

------
grandalf
this looks like a useful service... with one caveat in the form of a rant:

I wish people would stop trying to make response codes into more than they
are. Rest does not entail webdav, and without webdav there are not enough
semantics to try to do the kinds of things people typically try to make
response codes do.

If you are implementing webdav, call it that and stick to the spec, don't just
hack a middle ground and pretend you are designing the API properly.

~~~
emperorcezar
Sadly the http codes were never designed for API calls in the first place, but
are the recommended, and accepted way of expressing errors in APIs. The choice
is to use woefully vague codes, or move out into other standards such as
Webdav. Or of course custom codes.

~~~
masklinn
Obviously you can add a more detailed payload in the response body for
precision, HTTP status codes are the error class (similar to SQL error code
classes, or even the error codes themselves for such things as the class 23
codes)

------
yesimahuman
Last year I was the maintainer for jQuery-Mockjax
([https://github.com/appendto/jquery-
mockjax](https://github.com/appendto/jquery-mockjax)) which essentially mocks
jQuery's ajax calls. Makes it really easy to test these kinds of conditions on
the client without needing to set up a server.

IIRC it also supports simulated response delays. You'll never know the
difference!

~~~
spellboots
You should almost always, for almost every test suite, do this with a mocking
library.

That being said, I can think of some cases where this service would be really
useful, such as one of tests on live systems for example.

------
adsche
Are you the creator? FYI,
[http://mock.isssues.com/timeout](http://mock.isssues.com/timeout) gives me an
application error instead of returning successfully after 30s.

Result of

    
    
        curl -i http://mock.isssues.com/timeout 
    

here: [http://pastebin.com/nM1VTYwg](http://pastebin.com/nM1VTYwg)

~~~
adsche
OK works now (with a 28s delay apparently). Can't delete parent.

Did your webserver timeout on your CGI? :)

~~~
hondo522
Heroku was killing the request at 30 seconds, so it worked locally, but failed
after deploy.

------
jwcrux
Request:
[http://mock.isssues.com/{RESPONSE}/{MESSAGE}](http://mock.isssues.com/{RESPONSE}/{MESSAGE})

------
claudius
Must have been fun to implement 418 =)

It could help to link to some explanation/section in the RFC from the front
page error code. Apart from that, this is very nice and potentially useful,
thank you very much.

------
ville
Nice!

For completeness' sake, also 3xx redirects could be implemented, redirecting
to [http://mock.isssues.com/200](http://mock.isssues.com/200) for example.

------
waxjar
I'd rather mock stuff like this with a mocking library that doesn't involve
making requests to remote servers. The interwebs are (relatively) slow and I
want my tests to run fast.

~~~
ams6110
Sometimes you just want to do a quick test and not deal with the complexity of
a proper mocking library. But I agree this is not something you'd probably
want to bake into a continuous integration build.

------
guan
What happens when you request a non-existent URL at that site?

~~~
samuelh
$ curl -i [http://mock.isssues.com/888](http://mock.isssues.com/888) HTTP/1.1
404 Not Found Content-Type: text/html;charset=utf-8 Date: Sun, 21 Jul 2013
22:29:14 GMT Status: 404 Not Found X-Frame-Options: sameorigin X-Xss-
Protection: 1; mode=block Content-Length: 9 Connection: keep-alive

~~~
samuelh
$ curl -i [http://mock.isssues.com/fake/url](http://mock.isssues.com/fake/url)
curl: (6) Could not resolve host: mohttp; nodename nor servname provided, or
not known

------
dlitz
How do you know that you've implemented 402 correctly?

------
AndrewVos
anmo does all that, and more:
[https://github.com/sthulbourn/anmo](https://github.com/sthulbourn/anmo)

------
munimkazia
What about the redirect responses in the 3xx series?

