public static String resolvePath(String uri) {
		Objects.requireNonNull(uri, "uri");

		String tempUri = uri;

		int index = tempUri.indexOf('?');
		if (index > -1) {
			tempUri = tempUri.substring(0, index);
		}

		index = tempUri.indexOf('#');
		if (index > -1) {
			tempUri = tempUri.substring(0, index);
		}

		if (tempUri.isEmpty()) {
			return tempUri;
		}

		if (tempUri.charAt(0) == '/') {
			if (tempUri.length() == 1) {
				return tempUri;
			}
			tempUri = "http://localhost:8080" + tempUri;
		}
		else if (!SCHEME_PATTERN.matcher(tempUri).matches()) {
			tempUri = "http://" + tempUri;
		}

		return URI.create(tempUri)
		          .getPath();
	}
@Test
	void testFullPath() {
		assertThat(HttpOperations.resolvePath("http://localhost:8080")).isEqualTo("");
		assertThat(HttpOperations.resolvePath("http://localhost:8080/")).isEqualTo("/");
		assertThat(HttpOperations.resolvePath("http://localhost:8080//")).isEqualTo("//");
		assertThat(HttpOperations.resolvePath("http://localhost:8080///")).isEqualTo("///");
		assertThat(HttpOperations.resolvePath("http://localhost:8080/a")).isEqualTo("/a");
		assertThat(HttpOperations.resolvePath("http://localhost:8080/a/")).isEqualTo("/a/");
		assertThat(HttpOperations.resolvePath("http://localhost:8080/?b")).isEqualTo("/");
		assertThat(HttpOperations.resolvePath("http://localhost:8080/a?b")).isEqualTo("/a");
		assertThat(HttpOperations.resolvePath("http://localhost:8080/#b")).isEqualTo("/");
		assertThat(HttpOperations.resolvePath("http://localhost:8080/a#b")).isEqualTo("/a");
		assertThat(HttpOperations.resolvePath("http://localhost:8080/a?b#c")).isEqualTo("/a");
		assertThat(HttpOperations.resolvePath("http://localhost:8080/a%20b")).isEqualTo("/a b");
		assertThat(HttpOperations.resolvePath("http://localhost:8080/a?b={}")).isEqualTo("/a");

		assertThat(HttpOperations.resolvePath("localhost:8080")).isEqualTo("");
		assertThat(HttpOperations.resolvePath("localhost:8080/")).isEqualTo("/");
		assertThat(HttpOperations.resolvePath("localhost:8080//")).isEqualTo("//");
		assertThat(HttpOperations.resolvePath("localhost:8080///")).isEqualTo("///");
		assertThat(HttpOperations.resolvePath("localhost:8080/a")).isEqualTo("/a");
		assertThat(HttpOperations.resolvePath("localhost:8080/a/")).isEqualTo("/a/");
		assertThat(HttpOperations.resolvePath("localhost:8080/?b")).isEqualTo("/");
		assertThat(HttpOperations.resolvePath("localhost:8080/a?b")).isEqualTo("/a");
		assertThat(HttpOperations.resolvePath("localhost:8080/#b")).isEqualTo("/");
		assertThat(HttpOperations.resolvePath("localhost:8080/a#b")).isEqualTo("/a");
		assertThat(HttpOperations.resolvePath("localhost:8080/a?b#c")).isEqualTo("/a");
		assertThat(HttpOperations.resolvePath("localhost:8080/a%20b")).isEqualTo("/a b");
		assertThat(HttpOperations.resolvePath("localhost:8080/a?b={}")).isEqualTo("/a");

		assertThat(HttpOperations.resolvePath("")).isEqualTo("");
		assertThat(HttpOperations.resolvePath("/")).isEqualTo("/");
		assertThat(HttpOperations.resolvePath("//")).isEqualTo("//");
		assertThat(HttpOperations.resolvePath("///")).isEqualTo("///");
		assertThat(HttpOperations.resolvePath("/a")).isEqualTo("/a");
		assertThat(HttpOperations.resolvePath("/a/")).isEqualTo("/a/");
		assertThat(HttpOperations.resolvePath("/?b")).isEqualTo("/");
		assertThat(HttpOperations.resolvePath("/a?b")).isEqualTo("/a");
		assertThat(HttpOperations.resolvePath("/#b")).isEqualTo("/");
		assertThat(HttpOperations.resolvePath("/a#b")).isEqualTo("/a");
		assertThat(HttpOperations.resolvePath("/a?b#c")).isEqualTo("/a");
		assertThat(HttpOperations.resolvePath("/a%20b")).isEqualTo("/a b");
		assertThat(HttpOperations.resolvePath("/a?b={}")).isEqualTo("/a");
	}