Such thing as a dummy REST server to test HTTP req

2019-03-17 12:05发布

问题:

I have been searching around but cannot find any site like this. I want to know if there is some dummy server that will respond to test GET requests and return a JSON object? Basically something like:

HTTPUtil.httpGet("http://www.ipsumlorem.com/json");

and have it return filler text JSON objects like:

{
   "title" : "Ipsum Lorem",
   "content" : "blah blah blah"
}

回答1:

http://www.jsontest.com/ will be your new best friend I guess...

Try this out for your need: http://echo.jsontest.com/title/ipsum/content/blah

It will return this:

{
   "content": "blah",
   "title": "ipsum"
}


回答2:

You can use also www.mocky.io, where you mock your HTTP responses to test your REST API.

It is possible to change also the headers of the response and of course to write precisely the content (including json...)



回答3:

For following tutorials and giving workshops this could be useful as well: http://jsonplaceholder.typicode.com



回答4:

You can use http://apiary.io to create mock REST APIs very quickly.

If you don't care about the Content-Type it is even faster if you put a plain text file in Dropbox.



回答5:

You could use SoftwareMill's TestServer: https://github.com/softwaremill/softwaremill-common/tree/master/softwaremill-test/softwaremill-test-server



标签: http testing web