Commonize request-handler from s3-handler and rest-handler(2)