2.4 HTTP
On this page:
request-bindings
request-headers
extract-binding/ single
extract-bindings
exists-binding?
Version: 4.1.4
2.4.2 Bindings

 (require web-server/http/bindings)

These functions, while convenient, could introduce subtle bugs into your application. Examples: that they are case-insensitive could introduce a bug; if the data submitted is not in UTF-8 format, then the conversion to a string will fail; if an attacker submits a form field as if it were a file, when it is not, then the request-bindings will hold a bytes? object and your program will error; and, for file uploads you lose the filename. Therefore, we recommend against their use, but they are provided for compatibility with old code.

(request-bindings req)
  
(listof (or/c (cons/c symbol? string?)
              (cons/c symbol? bytes?)))
  req : request?

Translates the request-bindings/raw of req by interpreting bytes? as string?s, except in the case of binding:file bindings, which are left as is. Ids are then translated into lowercase symbols.

(request-headers req)  (listof (cons/c symbol? string?))
  req : request?

Translates the request-headers/raw of req by interpreting bytes? as string?s. Ids are then translated into lowercase symbols.

(extract-binding/single id binds)  string?
  id : symbol?
  binds : (listof (cons/c symbol? string?))

Returns the single binding associated with id in the a-list binds if there is exactly one binding. Otherwise raises exn:fail.

(extract-bindings id binds)  (listof string?)
  id : symbol?
  binds : (listof (cons/c symbol? string?))

Returns a list of all the bindings of id in the a-list binds.

(exists-binding? id binds)  boolean?
  id : symbol?
  binds : (listof (cons/c symbol? string))

Returns #t if binds contains a binding for id. Otherwise, #f.

Here is an example typical of what you will find in many applications:

  (define (get-number req)
    (string->number
     (extract-binding/single
      'number
      (request-bindings req))))