2008-06-02 16:00:03 -04:00
|
|
|
IN: furnace.tests
|
2008-09-22 18:15:59 -04:00
|
|
|
USING: http http.server.dispatchers http.server.responses
|
2008-11-24 21:26:11 -05:00
|
|
|
http.server furnace furnace.utilities tools.test kernel
|
|
|
|
namespaces accessors io.streams.string urls ;
|
2008-06-02 16:00:03 -04:00
|
|
|
TUPLE: funny-dispatcher < dispatcher ;
|
|
|
|
|
|
|
|
: <funny-dispatcher> funny-dispatcher new-dispatcher ;
|
|
|
|
|
|
|
|
TUPLE: base-path-check-responder ;
|
|
|
|
|
|
|
|
C: <base-path-check-responder> base-path-check-responder
|
|
|
|
|
|
|
|
M: base-path-check-responder call-responder*
|
|
|
|
2drop
|
|
|
|
"$funny-dispatcher" resolve-base-path
|
|
|
|
"text/plain" <content> ;
|
|
|
|
|
|
|
|
[ ] [
|
|
|
|
<dispatcher>
|
|
|
|
<dispatcher>
|
|
|
|
<funny-dispatcher>
|
|
|
|
<base-path-check-responder> "c" add-responder
|
|
|
|
"b" add-responder
|
|
|
|
"a" add-responder
|
|
|
|
main-responder set
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
[ "/a/b/" ] [
|
|
|
|
V{ } responder-nesting set
|
|
|
|
"a/b/c" split-path main-responder get call-responder body>>
|
|
|
|
] unit-test
|
2008-06-04 20:54:05 -04:00
|
|
|
|
2008-06-05 01:18:36 -04:00
|
|
|
[ "<input type='hidden' name='foo' value='&&&'/>" ]
|
2008-06-04 20:54:05 -04:00
|
|
|
[ [ "&&&" "foo" hidden-form-field ] with-string-writer ]
|
|
|
|
unit-test
|
2008-09-22 18:15:59 -04:00
|
|
|
|
|
|
|
[ f ] [ <request> request [ referrer ] with-variable ] unit-test
|
|
|
|
|
|
|
|
[ t ] [ URL" http://foo" dup url [ same-host? ] with-variable ] unit-test
|
|
|
|
|
|
|
|
[ f ] [ f URL" http://foo" url [ same-host? ] with-variable ] unit-test
|