xgoprev/tests/http.xgo

20 lines
306 B
Text
Raw Normal View History

fmt := import("fmt")
http := import("http")
os := import("os")
resp := http.post_json(
"https://jsonplaceholder.typicode.com/posts", {
title: "Hello, World!",
body: "Checking shit out!",
userId: 1
}
)
if is_error(resp) {
fmt.println(resp)
os.exit(1)
}
body := resp.body_json
fmt.println(body)