src/java.net.http/share/classes/jdk/internal/net/http/HttpRequestBuilderImpl.java
changeset 52902 e3398b2e1ab0
parent 50681 4254bed3c09d
equal deleted inserted replaced
52901:3ba9ff4d4aaf 52902:e3398b2e1ab0
   188     }
   188     }
   189 
   189 
   190     @Override
   190     @Override
   191     public HttpRequest.Builder method(String method, BodyPublisher body) {
   191     public HttpRequest.Builder method(String method, BodyPublisher body) {
   192         requireNonNull(method);
   192         requireNonNull(method);
   193         if (method.equals(""))
   193         if (method.isEmpty())
   194             throw newIAE("illegal method <empty string>");
   194             throw newIAE("illegal method <empty string>");
   195         if (method.equals("CONNECT"))
   195         if (method.equals("CONNECT"))
   196             throw newIAE("method CONNECT is not supported");
   196             throw newIAE("method CONNECT is not supported");
   197         if (!Utils.isValidName(method))
   197         if (!Utils.isValidName(method))
   198             throw newIAE("illegal method \""
   198             throw newIAE("illegal method \""
   203         return method0(method, requireNonNull(body));
   203         return method0(method, requireNonNull(body));
   204     }
   204     }
   205 
   205 
   206     private HttpRequest.Builder method0(String method, BodyPublisher body) {
   206     private HttpRequest.Builder method0(String method, BodyPublisher body) {
   207         assert method != null;
   207         assert method != null;
   208         assert !method.equals("");
   208         assert !method.isEmpty();
   209         this.method = method;
   209         this.method = method;
   210         this.bodyPublisher = body;
   210         this.bodyPublisher = body;
   211         return this;
   211         return this;
   212     }
   212     }
   213 
   213