http.xgo 306 B

12345678910111213141516171819
  1. fmt := import("fmt")
  2. http := import("http")
  3. os := import("os")
  4. resp := http.post_json(
  5. "https://jsonplaceholder.typicode.com/posts", {
  6. title: "Hello, World!",
  7. body: "Checking shit out!",
  8. userId: 1
  9. }
  10. )
  11. if is_error(resp) {
  12. fmt.println(resp)
  13. os.exit(1)
  14. }
  15. body := resp.body_json
  16. fmt.println(body)