@Test public void testRemoveParameter() throws Exception { final String url = "some_url"; final String name = "name"; final String value = "value"; HttpRequest request = new HttpRequest(url, (String)null).addParameter(name, value); assertThat(request.getRequestURL(), equalTo(url)); assertThat(request.getParameters(), equalTo(singletonMap(name, singletonList(value)))); assertThat(request.getParameters(name), equalTo(singletonList(value))); assertThat(request.getParameter(name), equalTo(value)); request = request.removeParameter(name); assertThat(request.getRequestURL(), equalTo(url)); assertTrue(request.getParameters().isEmpty()); assertTrue(request.getParameters(name).isEmpty()); assertNull(request.getParameter(name)); }
public HttpRequest removeParameter(String name) { checkNotNull(name, "name"); final Map<String, List<String>> params = new HashMap<>(parameters); params.remove(name); return new HttpRequest(requestURL, params, queryString); }
HttpRequest { public HttpRequest removeParameter(String name) { checkNotNull(name, "name"); final Map<String, List<String>> params = new HashMap<>(parameters); params.remove(name); return new HttpRequest(requestURL, params, queryString); } }
HttpRequest { public HttpRequest removeParameter(String name) { checkNotNull(name, "name"); final Map<String, List<String>> params = new HashMap<>(parameters); params.remove(name); return new HttpRequest(requestURL, params, queryString); } @Deprecated  HttpRequest(String requestURL);  HttpRequest(String requestURL, String queryString); @Deprecated  HttpRequest(String requestURL, Map<String, List<String>> parameters);  HttpRequest(String requestURL, Map<String, List<String>> parameters, String queryString); }
HttpRequest { public HttpRequest removeParameter(String name) { checkNotNull(name, "name"); final Map<String, List<String>> params = new HashMap<>(parameters); params.remove(name); return new HttpRequest(requestURL, params, queryString); } @Deprecated  HttpRequest(String requestURL);  HttpRequest(String requestURL, String queryString); @Deprecated  HttpRequest(String requestURL, Map<String, List<String>> parameters);  HttpRequest(String requestURL, Map<String, List<String>> parameters, String queryString); HttpRequest addParameter(String name, String value); HttpRequest removeParameter(String name); String getRequestURL(); String getParameter(String name); List<String> getParameters(String name); Map<String, List<String>> getParameters(); String getEncodedParameter(String name); String getEncodedParameter(String name, String defaultValue); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
HttpRequest { public HttpRequest removeParameter(String name) { checkNotNull(name, "name"); final Map<String, List<String>> params = new HashMap<>(parameters); params.remove(name); return new HttpRequest(requestURL, params, queryString); } @Deprecated  HttpRequest(String requestURL);  HttpRequest(String requestURL, String queryString); @Deprecated  HttpRequest(String requestURL, Map<String, List<String>> parameters);  HttpRequest(String requestURL, Map<String, List<String>> parameters, String queryString); HttpRequest addParameter(String name, String value); HttpRequest removeParameter(String name); String getRequestURL(); String getParameter(String name); List<String> getParameters(String name); Map<String, List<String>> getParameters(); String getEncodedParameter(String name); String getEncodedParameter(String name, String defaultValue); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static final Map<String, List<String>> EMPTY_PARAMETERS; }