The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,676 other followers

A url or site like example.org which always produces a 404 error (and two for 200 and 204)

Posted by jpluimers on 2014/09/10

Yesterday I posted this question on StackOverflow and G+: Is there a url or site like example.org which always produces a 404 error?

Soon after that, I found out three links that produce predictable HTTP status codes:

They also work for https:

On StackOverflow very few people even noticed the question, probably wondering “why?”.

I’m using these links for positive and negative testing of some http / https handling code that needs to be good at coping with positive and negative responses.

In my testing life, I’ve learned the hard way that both negative and positive tests are core part of your suite, hence the question.

–jeroen

via: Is there a url or site like example.org which always produces a 404 error?.    

Question

The example.org domain is for documentation purposes and a http request always resolves to it, so you get a HTTP 200 (OK) status code which means it can be used for positive testing.

Is there a URL for which it is known to always 404 that can be used for negative testing?

Answer

Studio 404si has posted links to a few pages of which the Google 404 actually gives a 404 http status code:

I found another page on Google that generates a status code, so I suspect there are more.

This one returns HTTP 204 (No Content) status code:

And of course the main site returns HTTP 200 (OK):

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: