Refactor URL HTTP method matching into a helper