import com.intellij.util.ArrayUtil;
import com.intellij.util.ReflectionUtil;
import com.intellij.util.SystemProperties;
+import com.intellij.util.net.HTTPMethod;
import com.intellij.util.net.HttpConfigurable;
import com.intellij.util.net.NetUtils;
import org.jetbrains.annotations.NotNull;
private String myUserAgent;
private String myAccept;
+ private HTTPMethod myMethod;
+
protected RequestBuilder(@NotNull String url) {
myUrl = url;
}
return ServiceManager.getService(HttpRequests.class).createRequestBuilder(url);
}
+ @NotNull
+ public static RequestBuilder head(@NotNull String url) {
+ RequestBuilder builder = request(url);
+ builder.myMethod = HTTPMethod.HEAD;
+ return builder;
+ }
+
protected abstract RequestBuilder createRequestBuilder(@NotNull String url);
private static <T> T wrapAndProcess(RequestBuilder builder, RequestProcessor<T> processor) throws IOException {
((HttpsURLConnection)connection).setHostnameVerifier(builder.myHostnameVerifier);
}
+ if (builder.myMethod != null) {
+ ((HttpURLConnection)connection).setRequestMethod(builder.myMethod.name());
+ }
+
if (builder.myGzip) {
connection.setRequestProperty("Accept-Encoding", "gzip");
}