introduce enumerator to do pagination

This is a nitpick, but we can save a few lines for this simple header assignment.
```ruby
headers.each {|k,v| req[key] = val}
```