pr9106, include in release
svn: r14133
This commit is contained in:
parent
f9c4e4eb54
commit
b3cec49237
|
@ -2,6 +2,7 @@
|
||||||
(require (planet schematics/schemeunit:3)
|
(require (planet schematics/schemeunit:3)
|
||||||
web-server/private/connection-manager
|
web-server/private/connection-manager
|
||||||
web-server/private/timer
|
web-server/private/timer
|
||||||
|
web-server/http/request
|
||||||
web-server/http)
|
web-server/http)
|
||||||
(provide request-tests)
|
(provide request-tests)
|
||||||
|
|
||||||
|
@ -21,6 +22,7 @@
|
||||||
ip op (make-custodian) #f)
|
ip op (make-custodian) #f)
|
||||||
headers)))
|
headers)))
|
||||||
|
|
||||||
|
|
||||||
(define (get-bindings post-data)
|
(define (get-bindings post-data)
|
||||||
(define-values (conn headers) (make-mock-connection&headers 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))
|
(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
|
; XXX This needs to be really extensive, see what Apache has
|
||||||
(test-suite
|
(test-suite
|
||||||
"Parsing"
|
"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
|
(test-suite
|
||||||
"POST Bindings"
|
"POST Bindings"
|
||||||
(test-equal? "simple test 1"
|
(test-equal? "simple test 1"
|
||||||
|
|
|
@ -152,11 +152,14 @@
|
||||||
(define (read-bindings&post-data/raw conn meth uri headers)
|
(define (read-bindings&post-data/raw conn meth uri headers)
|
||||||
(cond
|
(cond
|
||||||
[(bytes-ci=? #"GET" meth)
|
[(bytes-ci=? #"GET" meth)
|
||||||
(values (map (match-lambda
|
(values (filter (lambda (x) x)
|
||||||
|
(map (match-lambda
|
||||||
[(list-rest k v)
|
[(list-rest k v)
|
||||||
|
(if (and (symbol? k) (string? v))
|
||||||
(make-binding:form (string->bytes/utf-8 (symbol->string k))
|
(make-binding:form (string->bytes/utf-8 (symbol->string k))
|
||||||
(string->bytes/utf-8 v))])
|
(string->bytes/utf-8 v))
|
||||||
(url-query uri))
|
#f)])
|
||||||
|
(url-query uri)))
|
||||||
#f)]
|
#f)]
|
||||||
[(bytes-ci=? #"POST" meth)
|
[(bytes-ci=? #"POST" meth)
|
||||||
(local
|
(local
|
||||||
|
|
Loading…
Reference in New Issue
Block a user