-
Notifications
You must be signed in to change notification settings - Fork 0
Features
Marcin Koziarz edited this page Aug 21, 2015
·
1 revision
QuickRest rest = new QuickRest();
String response = rest.post("http://myapp.com/api/person")
.header("Cache-Control", no-cache)
.field("name","John")
.field("age","35")
.asString();
QuickRest rest = new QuickRest();
/* Will call POST to http://myapp.com/api/person/?name=John */
String response = rest.post("http://myapp.com/api/person/")
.query("name","John")
.asString();
/* Will call POST to http://myapp.com/api/person/?age=36&name=John */
String response = rest.post("http://myapp.com/api/person/?age=36")
.query("name","John")
.asString();
QuickRest rest = new QuickRest();
/* Will call GET from http://myapp.com/api/person/John */
String response = rest.get("http://{domain}.com/api/person/{name}")
.pathParam("domain","myapp")
.pathParam("name","John")
.asString();
QuickRest rest = new QuickRest();
/* Will throw QuickRestException on 404 NOT FOUND because it expects 200 OK code as default */
String response = rest.get("http://myapp.com/api/noresource")
.asString();
/* Won't throw exception on 404 NOT FOUND code as expected */
String response = rest.get("http://myapp.com/api/noresource")
.expectResponseStatus(404)
.asString();