shrub/lib/http.hoon

36 lines
778 B
Plaintext
Raw Normal View History

2015-05-07 00:00:06 +03:00
::
2016-02-11 03:41:28 +03:00
:::: /hoon/http/lib
2015-05-07 00:00:06 +03:00
::
::
::
/? 310
2016-11-17 04:42:58 +03:00
::
2016-12-03 03:56:54 +03:00
=, mimes:html
=, html
2015-05-07 00:00:06 +03:00
|%
2015-09-02 01:20:17 +03:00
++ request
2019-01-18 08:37:34 +03:00
$: domain/(list cord)
2015-12-20 23:50:45 +03:00
end-point/path
2019-01-18 08:37:34 +03:00
req-type/$?($get {$post p/json})
2017-10-24 00:50:31 +03:00
headers/math:eyre
queries/quay:eyre
2015-09-02 01:20:17 +03:00
==
++ send
2015-12-20 23:50:45 +03:00
|= {ost/bone pour-path/wire params/request}
2015-09-02 01:20:17 +03:00
:^ ost %them pour-path
2017-10-24 00:50:31 +03:00
`(unit hiss:eyre)`[~ (request-to-hiss params)]
2015-05-29 02:07:03 +03:00
::
2015-09-02 01:20:17 +03:00
++ request-to-hiss
2017-10-24 00:50:31 +03:00
|= request ^- hiss:eyre
2015-09-02 01:20:17 +03:00
=- ~& hiss=- -
2017-10-24 00:50:31 +03:00
:- ^- parsed-url/purl:eyre
2015-09-02 01:20:17 +03:00
:+ :+ security=%.y
port=~
host=[%.y [path=domain]]
endpoint=[extensions=~ point=end-point] :: ++pork,
q-strings=queries :: ++quay
?@ req-type
[%get headers ~]
2017-10-24 00:50:31 +03:00
[%post headers ~ (as-octt:mimes:html (en-json p.req-type))]
2015-05-07 00:00:06 +03:00
--