on master help sign in
http in gall fixes
843d0b3joshuareagan
docs/tutorials/gall/http.umd+11−11
@@ -24,7 +24,7 @@ code isn't 2xx. Save the following as `app/up.hoon`:
24|%
24|%
25+$ move [bone card]
25+$ move [bone card]
26+$ card
26+$ card
27− $% [%hiss wire unit-iden=$~ mark=%httr cage=[mark=%purl vase=purl]]
27+ $% [%hiss wire unit-iden=$~ mark=%httr cage=[mark=%purl vase=purl:eyre]]
28 [%wait wire @da]
28 [%wait wire @da]
29 ==
29 ==
30+$ action
30+$ action
@@ -35,7 +35,7 @@ code isn't 2xx. Save the following as `app/up.hoon`:
35--
35--
36|_ [hid=bowl:gall on=_| in-progress=_| target=@t]
36|_ [hid=bowl:gall on=_| in-progress=_| target=@t]
37++ poke-atom
37++ poke-atom
38− |= url-or-command=@t ^- (quip move +>)
38+ |= url-or-command=@t ^- (quip move _+>)
39 =+ ^- act/action
39 =+ ^- act/action
40 ?: ?=($on url-or-command) [%on ~]
40 ?: ?=($on url-or-command) [%on ~]
41 ?: ?=($off url-or-command) [%off ~]
41 ?: ?=($off url-or-command) [%off ~]
@@ -45,11 +45,11 @@ code isn't 2xx. Save the following as `app/up.hoon`:
45 $off [~ +>.$(on |)]
45 $off [~ +>.$(on |)]
46 $on
46 $on
47 :- ?: |(on in-progress) ~
47 :- ?: |(on in-progress) ~
48− [ost.hid %hiss /request ~ %httr %purl (need (epur target))]~
48+ [ost.hid %hiss /request ~ %httr %purl (need (de-purl:html target))]~
49 +>.$(on &, in-progress &)
49 +>.$(on &, in-progress &)
50 ==
50 ==
51++ sigh-httr
51++ sigh-httr
52− |= [wir=wire code=@ud headers=mess body=(unit octs)]
52+ |= [wir=wire code=@ud headers=mess:eyre body=(unit octs)]
53 ~& 'arrive here'
53 ~& 'arrive here'
54 ^- [(list move) _+>.$]
54 ^- [(list move) _+>.$]
55 ?: &((gte code 200) (lth code 300))
55 ?: &((gte code 200) (lth code 300))
@@ -62,10 +62,10 @@ code isn't 2xx. Save the following as `app/up.hoon`:
62 :_ +>.$
62 :_ +>.$
63 [ost.hid %wait /timer (add ~s10 now.hid)]~
63 [ost.hid %wait /timer (add ~s10 now.hid)]~
64++ wake-timer
64++ wake-timer
65− |= [wir=wire $~] ^- (quip move +>)
65+ |= [wir=wire $~] ^- (quip move _+>)
66 ?: on
66 ?: on
67 :_ +>.$
67 :_ +>.$
68− [ost.hid %hiss /request ~ %httr %purl (need (epur target))]~
68+ [ost.hid %hiss /request ~ %httr %purl (need (de-purl:html target))]~
69 [~ +>.$(in-progress |)]
69 [~ +>.$(in-progress |)]
70::
70::
71++ prep ~& target _`. :: computed when the source file changes;
71++ prep ~& target _`. :: computed when the source file changes;
@@ -88,9 +88,9 @@ r=cage]` from `zuse`.
88
88
89> Recall that `++unit` means "maybe". Formally, "`(unit a)` is either null or a pair of null and a value in `a`". Also recall that to pull a value out of a unit (`u.unit`), you must first verify that the unit is not null (for example with `?~`). See `++need`.
89> Recall that `++unit` means "maybe". Formally, "`(unit a)` is either null or a pair of null and a value in `a`". Also recall that to pull a value out of a unit (`u.unit`), you must first verify that the unit is not null (for example with `?~`). See `++need`.
90
90
91−A `purl` is a parsed url structure, which can be created with `++epur`,
91+A `purl:eyre` is a parsed url structure, which can be created with `de-purl:html`,
92which is a function that takes a url as text and parses it into a `(unit
92which is a function that takes a url as text and parses it into a `(unit
93−purl)`. Thus, the result is null if and only if the url is malformed.
93+purl:eyre)`. Thus, the result is null if and only if the url is malformed.
94'Purl' is also the mark which will be applied to this result.
94'Purl' is also the mark which will be applied to this result.
95
95
96When you send this request, you can expect a `%sigh` with the
96When you send this request, you can expect a `%sigh` with the
@@ -104,7 +104,7 @@ produce a `%wake` when the time comes.
104Let's take a look at our state:
104Let's take a look at our state:
105
105
106```
106```
107−|_ [hid=bowl:gall on=_| in-progress=_| target=@t}
107+|_ [hid=bowl:gall on=_| in-progress=_| target=@t]
108```
108```
109
109
110We have three pieces of app-specific state. `target` is the url
110We have three pieces of app-specific state. `target` is the url
@@ -137,7 +137,7 @@ actual url, so we save it in `target`.
137Here's the move that sends the HTTP request:
137Here's the move that sends the HTTP request:
138
138
139```
139```
140−[ost.hid %hiss /request ~ %httr %purl (need (epur target))]
140+[ost.hid %hiss /request ~ %httr %purl (need (de-purl:html target))]
141```
141```
142
142
143> Remember, we are expected to produce a *list* of moves. Note the `~` after the move in the full example. This is a convenient shortcut for creating a list of a single element. It's part of a small family of such shortcuts. `~[a b c]` is `[a b c ~]`, `[a b c]~` is `[[a b c] ~]` and `\`[a b c]` is `[~ a b c]`. These may be mixed and matched to create various convoluted structures and emojis.
143> Remember, we are expected to produce a *list* of moves. Note the `~` after the move in the full example. This is a convenient shortcut for creating a list of a single element. It's part of a small family of such shortcuts. `~[a b c]` is `[a b c ~]`, `[a b c]~` is `[[a b c] ~]` and `\`[a b c]` is `[~ a b c]`. These may be mixed and matched to create various convoluted structures and emojis.
@@ -151,7 +151,7 @@ visualize on one line. Here it is more pedantically:
151 wire=/request
151 wire=/request
152 unit-iden=~
152 unit-iden=~
153 mark=%httr
153 mark=%httr
154− cage=[%purl (need (epur target))]
154+ cage=[%purl (need (de-purl:html target))]
155==
155==
156```
156```
157
157