Refactor redundant code for summarizing a request method and URI