How to make HTTP requests?

read http://www.rebol.com/

ref red wiki

write/info url [
  method [word!]           "Method type (GET, POST, PUT, DELETE, HEAD)"
  header [block!]          "Optional. Contents must be one of [set-word! string!]"
  data   [string! binary!] "Optional"
]
  • GET
read/info https://httpbin.org/get

[200
 #(
   Access-Control-Allow-Origin: "*"
   Via: "1.1 vegur"
   Server: "gunicorn/19.8.1"
   Content-Type: "application/json"
   Content-Length: "285"
   Connection: "close"
   Date: "Wed, 11 Jul 2018 06:43:49 GMT"
   Access-Control-Allow-Credentials: "true"
 )
 {
   {"args":{},"headers":{"Connection":"close","Content-Type":"application/x-www-form-urlencoded; charset=utf-8","Host":"httpbin.org","User-Agent":"console-2017-8-3-49893 (unknown version) CFNetwork/901.1 Darwin/17.6.0 (x86_64)"},"origin":"116.100.220.206","url":"http://httpbin.org/get"}^/
 }
]
  • POST
set [status header body] write/info https://httpbin.org/post [
  POST
  [Content-Type: "application/json"]
  {{"foo": "bar"}}
]

probe json/decode body
#(
  args: #()
  data: {{"foo": "bar"}}
  files: #()
  form: #()
  headers: #(
    Connection: "close"
    Content-Length: "17"
    Content-Type: "application/json"
    Host: "httpbin.org"
    User-Agent: {console-2017-8-3-49893 (unknown version) CFNetwork/901.1 Darwin/17.6.0 (x86_64)}
  )
  json: #(
    foo: "bar"
  )
  origin: "116.100.220.206"
  url: "https://httpbin.org/post"
)