Skip to content

Instantly share code, notes, and snippets.

@slaykovsky slaykovsky/curl
Created Feb 13, 2017

Embed
What would you like to do?
$ 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
You can’t perform that action at this time.