The HTTP Response API is a simple API service to generate HTTP responses for different HTTP status codes, using different HTTP methods, and optionally returning user-defined HTTP response headers.

The HTTP Response API can be used to test how your code deals with varying HTTP responses.

Just add the HTTP status code you want to the URL, like this:

    
https://http.codes/200

And a text/plain HTTP response will be returned, like this:

    
HTTP/1.1 {status code} {status description}
Content-Type: text/plain or application/json or text/xml or message/http
Content-Length: {something}
{any custom response headers}

{status code} {status description}
{list of any custom response headers}

The HTTP Response API is coded and provided by ex-Google engineer and technical SEO expert Fili.

JSON response

To get a JSON response back instead of a text/plain content type response, ensure that the HTTP request header: Accept contains 'application/json', like:

    
Accept: application/json

Then the response body will be encoded to JSON format, with the appropiate HTTP header: Content-Type .

Adding a delay to the HTTP response

If you want a delay on the HTTP response, there are two options:

Add the X-Delay HTTP header for the sleep duration (the time is in seconds, max 60 seconds), like this:

    
X-Delay: 300

Alternatively provide the query string ?delay= to the URL for the sleep duration (the time is in seconds, max 60 seconds), like this:

    
https://http.codes/200?delay=5

Adding HTTP response headers

If you want to return additional HTTP headers to the client, these can be added to the HTTP request with the X-Custom- prefix.

For example, a HTTP header in the HTTP request like this:

    
X-Custom-Foo: Bar

will append the following HTTP header to the HTTP response.

    
Foo: Bar

However the following HTTP headers are reserved and cannot be set and/or changed:

Supported HTTP methods

The following HTTP methods are supported: