Skip to content

Simple API that echos a JSON back and validates if the JSON is valid. If not, returns a 400.

Notifications You must be signed in to change notification settings

aborigene/my-echo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

http-echo

A simple node.js HTTP server for testing that will echo back a response, which you can control by passing querystring parameters.

The server will respond to any URL.

Available parameters

  • status: HTTP status code to send back. Defaults to 200.
  • contentType: MIME type to send back in the Content-Type header. Defaults to 'text/plain'.
  • body: The body to send back in the response. Defaults to 'hello there!'.

Example request and response

Request:

GET http://localhost:3000/mytest?status=500&contentType=application/json&body={"error":"a message!"}

Response:

HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Content-Length: 20
Date: Wed, 10 Apr 2013 21:05:18 GMT
Connection: keep-alive

{"error":"a message!"}

About

Simple API that echos a JSON back and validates if the JSON is valid. If not, returns a 400.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published