Add function binding-assq-all to request-structs.rkt
This commit is contained in:
parent
89234bde9e
commit
14084d560d
|
@ -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?])]
|
||||
|
|
|
@ -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?)]
|
||||
|
|
Loading…
Reference in New Issue
Block a user