on master help sign in
Merge remote-tracking branch 'henry/cleanorg' into cleanorg
5e6a67fPhilip C Monk
docs/programming/system/http.md+11−11
@@ -9,21 +9,21 @@ Let's figure out how to make HTTP requests and set timers.
9
9
10Let's build an uptime-monitoring system. It'll ping a web
10Let's build an uptime-monitoring system. It'll ping a web
11service periodically and print out an error when the response
11service periodically and print out an error when the response
12−code isn't 2xx. Here's `ape/up.hoon`:
12+code isn't 2xx. Here's `app/up.hoon`:
13
13
14```
14```
15/? 314
15/? 314
16|%
16|%
17−++ move ,[bone card]
17+++ move {bone card}
18++ card
18++ card
19− $% [%them wire (unit hiss)]
19+ $% {%them wire (unit hiss)}
20− [%wait wire @da]
20+ {%wait wire @da}
21 ==
21 ==
22--
22--
23−|_ [hid=bowl on=_| in-progress=_| target=@t]
23+|_ {hid/bowl on/_| in-progress=_| target/@t}
24++ poke-cord
24++ poke-cord
25− |= url=@t
25+ |= url/@t
26− ^- [(list move) _+>.$]
26+ ^- {(list move) _+>.$}
27 ?: =('off' url)
27 ?: =('off' url)
28 [~ +>.$(on |)]
28 [~ +>.$(on |)]
29 ?: =('on' url)
29 ?: =('on' url)
@@ -33,8 +33,8 @@ code isn't 2xx. Here's `ape/up.hoon`:
33 [ost.hid %them /request ~ (need (epur target)) %get ~ ~]~
33 [ost.hid %them /request ~ (need (epur target)) %get ~ ~]~
34 [~ +>.$(target url)]
34 [~ +>.$(target url)]
35++ thou-request
35++ thou-request
36− |= [wir=wire code=@ud headers=mess body=(unit octs)]
36+ |= {wir/wire code/@ud headers/mess body/(unit octs)}
37− ^- [(list move) _+>.$]
37+ ^- {(list move) _+>.$}
38 ?: &((gte code 200) (lth code 300))
38 ?: &((gte code 200) (lth code 300))
39 ~& [%all-is-well code]
39 ~& [%all-is-well code]
40 :_ +>.$
40 :_ +>.$
@@ -49,7 +49,7 @@ code isn't 2xx. Here's `ape/up.hoon`:
49 [ost.hid %wait /timer (add ~s10 now.hid)]~
49 [ost.hid %wait /timer (add ~s10 now.hid)]~
50 ~
50 ~
51++ wake-timer
51++ wake-timer
52− |= [wir=wire ~]
52+ |= {wir/wire ~}
53 ?: on
53 ?: on
54 :_ +>.$
54 :_ +>.$
55 [ost.hid %them /request ~ (need (epur target)) %get ~ ~]~
55 [ost.hid %them /request ~ (need (epur target)) %get ~ ~]~
@@ -97,7 +97,7 @@ produce a `%wake` when the time comes.
97Let's take a look at our state:
97Let's take a look at our state:
98
98
99```
99```
100−|_ [hid=bowl on=_| in-progress=_| target=@t]
100+|_ {hid/bowl on/_| in-progress=_| target/@t}
101```
101```
102
102
103We have three pieces of app-specific state. `target` is the url
103We have three pieces of app-specific state. `target` is the url