request.scm
(module request mzscheme
  (provide make-test-request
           current-request)
  
  (require (lib "servlet.ss" "web-server")
           (lib "kw.ss")
           (lib "url.ss" "net"))
  
  (define current-request (make-parameter #f))
  
  (define/kw (make-test-request
              #:key
              (method        'get)
              (uri           (string->url "http://localhost/"))
              (headers/raw   '())
              (bindings/raw  '())
              (post-data/raw #f)
              (host-ip       "127.0.0.1")
              (host-port     80)
              (client-ip    "127.0.0.1"))
    
    #;(provide/contract
       [struct request ([method symbol?]
                        [uri url?] 
                        [headers/raw (listof header?)]
                        [bindings/raw (listof binding?)]
                        [post-data/raw (or/c false/c bytes?)]
                        [host-ip string?] [host-port number?]
                        [client-ip string?])])
    
    (make-request method uri headers/raw bindings/raw post-data/raw
                  host-ip host-port client-ip)))