Closed merwok closed 4 years ago
In general the official predicates are always an "and" operation, but if that's what you're proposing then I see no issue with accepting a PR that added that to the predicate.
Yes, the request was to have all headers matching, like other built-in predicates. PR incoming
Feature Request
Is your feature request related to an issue? Please describe. We can use predicates like
header="X-GitHub-Whatever"
orheader="X-Facebook-Thing:cool-value"
within a route or view config. However, it is not possible to specify more than one header, so one would need to write a custom predicate here, or perform checks inside the view.Describe the solution you'd like
header
should accept a string or tuple of strings, likerequest_param
does.Describe alternatives you've considered New parameter
headers
always taking a sequence—would not fit with existing behaviour forrequest_param
and others.Additional context Implementation should be easy in
pyramid.predicates.HeaderPredicate
. Tuples were not accepted before, so no compatibility issue.