Skip to content

Instantly share code, notes, and snippets.

@slaykovsky
Created February 13, 2017 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slaykovsky/bbe650b13fe53821d6166b19290b5ceb to your computer and use it in GitHub Desktop.
Save slaykovsky/bbe650b13fe53821d6166b19290b5ceb to your computer and use it in GitHub Desktop.
$ curl -X POST -H "Accept: application/json" -H "Content-Type: applicaion/json" -d '{"machine": "host", "name": "test", "size": "4", "run": "3", "result": "3838.44"}' http://localhost:8080/api/testRuns -vvv
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> POST /api/testRuns HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.50.1
> Accept: application/json
> Content-Type: application/json
> Content-Length: 81
>
* upload completely sent off: 81 out of 81 bytes
< HTTP/1.1 200 OK
< content-type: application/json
< Content-Length: 98
<
{
"machine" : "host",
"name" : "test",
"size" : "4",
"run" : "3",
"result" : "3838.44"
* Connection #0 to host localhost left intact
}aslaikov@exodus:~/Documents/ovirt-engine$
router.post("/api/testRuns").handler(ctx -> {
HttpServerResponse response = ctx.response();
SQLConnection conn = ctx.get("conn");
JsonObject body = ctx.getBodyAsJson();
response.setStatusCode(200).putHeader("content-type", "application/json").end(body.encodePrettily());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment