fknop / hapi-pagination

Hapi plugin to handle "custom" pagination
MIT License
63 stars 35 forks source link

Include custom headers from pre-processed response #69

Closed vsarpe closed 6 years ago

vsarpe commented 6 years ago

This pull request allows headers (and other response properties) set in a handler to be present after onPostHandler -- when pagination info is returned as part of the body.

Example: return h.paginate(...).headers('My-Header', 'value');

In the current version, the header is not present in the final response because the original response is replaced by a new one:

It seems that just changing the source of the original response is appropriate - all tests still pass. Is there a reason to replace the original response entirely?

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 56e4ccf776b619bb1ed68fc0b2bc7ad89341d6ab on vsarpe:master into 80d8e86921a11956b6b3cdb779dee42d8ca213c0 on fknop:master.