pr9106, include in release
svn: r14133
This commit is contained in:
parent
f9c4e4eb54
commit
b3cec49237
|
@ -2,6 +2,7 @@
|
|||
(require (planet schematics/schemeunit:3)
|
||||
web-server/private/connection-manager
|
||||
web-server/private/timer
|
||||
web-server/http/request
|
||||
web-server/http)
|
||||
(provide request-tests)
|
||||
|
||||
|
@ -21,6 +22,7 @@
|
|||
ip op (make-custodian) #f)
|
||||
headers)))
|
||||
|
||||
|
||||
(define (get-bindings post-data)
|
||||
(define-values (conn headers) (make-mock-connection&headers post-data))
|
||||
(call-with-values (lambda () (read-bindings&post-data/raw conn #"POST" #f headers))
|
||||
|
@ -54,6 +56,18 @@
|
|||
; XXX This needs to be really extensive, see what Apache has
|
||||
(test-suite
|
||||
"Parsing"
|
||||
(test-suite
|
||||
"URL Query"
|
||||
(test-not-exn "Unfinished URL query"
|
||||
(lambda ()
|
||||
(define ip (open-input-string "GET http://127.0.0.1:8080/servlets/examples/hello.ss?a=1&b: HTTP/1.1"))
|
||||
(read-request
|
||||
(make-connection 0 (make-timer ip +inf.0 (lambda () (void)))
|
||||
ip
|
||||
(open-output-bytes) (make-custodian) #f)
|
||||
8081
|
||||
(lambda _ (values "s1" "s2"))))))
|
||||
|
||||
(test-suite
|
||||
"POST Bindings"
|
||||
(test-equal? "simple test 1"
|
||||
|
|
|
@ -152,11 +152,14 @@
|
|||
(define (read-bindings&post-data/raw conn meth uri headers)
|
||||
(cond
|
||||
[(bytes-ci=? #"GET" meth)
|
||||
(values (map (match-lambda
|
||||
[(list-rest k v)
|
||||
(make-binding:form (string->bytes/utf-8 (symbol->string k))
|
||||
(string->bytes/utf-8 v))])
|
||||
(url-query uri))
|
||||
(values (filter (lambda (x) x)
|
||||
(map (match-lambda
|
||||
[(list-rest k v)
|
||||
(if (and (symbol? k) (string? v))
|
||||
(make-binding:form (string->bytes/utf-8 (symbol->string k))
|
||||
(string->bytes/utf-8 v))
|
||||
#f)])
|
||||
(url-query uri)))
|
||||
#f)]
|
||||
[(bytes-ci=? #"POST" meth)
|
||||
(local
|
||||
|
|
Loading…
Reference in New Issue
Block a user