Handbook
Glossary
parse-fetch-command ( string -- request )
Vocabulary
chrome-tools
Inputs
string
an
object
Outputs
request
an
object
Definition
USING:
accessors
ascii
assocs
combinators
http
json
kernel
sequences
splitting
urls
;
IN:
chrome-tools
:
parse-fetch-command
( string -- request )
[
blank?
]
trim
"fetch("
?head
drop
", "
split1
[
<request>
swap
trim-dquotes
>url
>>url
]
dip
");"
?tail
drop
json>
[
swap
{
{
"method"
[
[
>>method
]
curry
]
}
{
"headers"
[
[
swap
dup
"if-modified-since"
=
~quotation~ ~quotation~
if
]
{
}
assoc>map
[
]
concat-as
]
}
{
"body"
[
[
dup
json-null
=
~quotation~ ~quotation~
if
]
curry
]
}
[
2drop
f
]
}
case
]
{
}
assoc>map
[
]
concat-as
curry
( -- request )
call-effect
;