-
-
Save slaykovsky/bbe650b13fe53821d6166b19290b5ceb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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