Split wrap_request into its own method so it can be called from elsewhere