annotate samples/http.tp @ 157:55e0dca7d3d7

Partial implementation of HTTP get requests
author Mike Pavone <pavone@retrodev.com>
date Sat, 10 Aug 2013 15:06:56 -0700
parents 075b1e71feff
children
rev   line source
pavone@149 1 #{
pavone@153 2 main <- :args {
pavone@153 3 server <- "rhope.retrodev.com"
pavone@153 4 if: (args length) > 1 {
pavone@153 5 server <- args get: 1
pavone@153 6 }
pavone@153 7 cli <- http client: server
pavone@157 8 resp <- (cli get: "/")
pavone@157 9 print: "Status: " . (resp status) . "\n"
pavone@157 10 print: "Code: " . (resp statusCode) . "\n"
pavone@157 11 print: "Headers:\n"
pavone@157 12 foreach: (resp headers) :key val {
pavone@157 13 print: key . " -> " . val . "\n"
pavone@157 14 }
pavone@157 15 print: "Body:\n" . (resp body) . "\n"
pavone@149 16 }
pavone@149 17 }