File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
src/main/java/org/kohsuke/github/extras Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 144144 <version >2.7.5</version >
145145 <optional >true</optional >
146146 </dependency >
147+ <dependency >
148+ <groupId >com.squareup.okhttp3</groupId >
149+ <artifactId >okhttp-urlconnection</artifactId >
150+ <version >3.4.0</version >
151+ <optional >true</optional >
152+ </dependency >
147153 <dependency >
148154 <groupId >org.kohsuke</groupId >
149155 <artifactId >wordnet-random-name</artifactId >
Original file line number Diff line number Diff line change 1+ package org .kohsuke .github .extras ;
2+
3+ import okhttp3 .OkHttpClient ;
4+ import okhttp3 .OkUrlFactory ;
5+ import org .kohsuke .github .HttpConnector ;
6+
7+ import java .io .IOException ;
8+ import java .net .HttpURLConnection ;
9+ import java .net .URL ;
10+
11+ /**
12+ * {@link HttpConnector} for {@link OkHttpClient}.
13+ *
14+ * Unlike {@link #DEFAULT}, OkHttp does response caching.
15+ * Making a conditional request against GitHubAPI and receiving a 304
16+ * response does not count against the rate limit.
17+ * See http://developer.github.com/v3/#conditional-requests
18+ *
19+ * @author Roberto Tyley
20+ * @author Kohsuke Kawaguchi
21+ */
22+ public class OkHttp3Connector implements HttpConnector {
23+ private final OkUrlFactory urlFactory ;
24+
25+ public OkHttp3Connector (OkUrlFactory urlFactory ) {
26+ this .urlFactory = urlFactory ;
27+ }
28+
29+ public HttpURLConnection connect (URL url ) throws IOException {
30+ return urlFactory .open (url );
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments