File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
analytics-core/src/main/java/com/segment/analytics/http
analytics/src/main/java/com/segment/analytics Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 7
7
8
8
/** REST interface for the Segment API. */
9
9
public interface SegmentService {
10
- @ POST ("" )
10
+ @ POST (". " )
11
11
Call <UploadResponse > upload (@ Body Batch batch );
12
12
}
Original file line number Diff line number Diff line change @@ -124,7 +124,8 @@ private Message buildMessage(MessageBuilder builder) {
124
124
125
125
/** Fluent API for creating {@link Analytics} instances. */
126
126
public static class Builder {
127
- private static final HttpUrl DEFAULT_ENDPOINT = HttpUrl .parse ("https://api.segment.io" );
127
+ private static final String DEFAULT_ENDPOINT = "https://api.segment.io" ;
128
+ private static final String DEFAULT_PATH = "/v1/import/" ;
128
129
private static final String DEFAULT_USER_AGENT = "analytics-java/" + AnalyticsVersion .get ();
129
130
130
131
private final String writeKey ;
@@ -176,7 +177,7 @@ public Builder endpoint(String endpoint) {
176
177
if (endpoint == null || endpoint .trim ().length () == 0 ) {
177
178
throw new NullPointerException ("endpoint cannot be null or empty." );
178
179
}
179
- this .endpoint = HttpUrl .parse (endpoint + "/v1/import/" );
180
+ this .endpoint = HttpUrl .parse (endpoint + DEFAULT_PATH );
180
181
return this ;
181
182
}
182
183
@@ -324,16 +325,17 @@ public Analytics build() {
324
325
.create ();
325
326
326
327
if (endpoint == null ) {
327
- endpoint = DEFAULT_ENDPOINT ;
328
+ endpoint = HttpUrl .parse (DEFAULT_ENDPOINT + DEFAULT_PATH );
329
+ }
328
330
329
- if (uploadURL != null ) {
330
- endpoint = uploadURL ;
331
- }
331
+ if (endpoint == null && uploadURL != null ) {
332
+ endpoint = uploadURL ;
332
333
}
333
334
334
335
if (client == null ) {
335
336
client = Platform .get ().defaultClient ();
336
337
}
338
+
337
339
if (log == null ) {
338
340
log = Log .NONE ;
339
341
}
You can’t perform that action at this time.
0 commit comments