[AUR-3234] Datastore scans the whol dataset during pagination

- Added setting response headers as a separate function.

Change-Id: I3c36b257d3e1b4b4549c1fd3205c28abf67ca546