Add function binding-assq-all to request-structs.rkt

This commit is contained in:
Tom McNulty 2012-03-03 15:06:20 -07:00 committed by Eli Barzilay
parent 89234bde9e
commit 14084d560d
2 changed files with 55 additions and 41 deletions

View File

@ -43,8 +43,15 @@
(if (equal? ti i)
b
(bindings-assq ti bs))]))
(define (bindings-assq-all ti bs)
(for/list ([b (in-list bs)]
#:when (and (binding? b) (equal? ti (binding-id b))))
b))
(provide/contract
[bindings-assq (bytes? (listof binding?) . -> . (or/c false/c binding?))]
[bindings-assq-all (bytes? (listof binding?) . -> . (listof binding?))]
[struct binding ([id bytes?])]
[struct (binding:form binding) ([id bytes?]
[value bytes?])]

View File

@ -54,6 +54,13 @@ The @web-server implements many HTTP libraries that are provided by this module.
Returns the binding with an id equal to @racket[id] from @racket[binds] or @racket[#f].
}
@defproc[(bindings-assq-all [id bytes?]
[binds (listof binding?)])
(listof binding?)]{
Like @racket[bindings-assq], but returns a list of all bindings matching @racket[id].
}
@defstruct[request ([method bytes?]
[uri url?]
[headers/raw (listof header?)]