-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow per-request base URIs in HttpClient #7922
Changes from 1 commit
be10518
6e55571
0e13702
3143891
0f8f8b3
104a5d6
7411103
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,10 @@ | |
*/ | ||
package org.projectnessie.client.http; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
import static org.projectnessie.client.http.impl.HttpUtils.checkArgument; | ||
|
||
import java.net.URI; | ||
import org.projectnessie.client.http.HttpClient.Method; | ||
import org.projectnessie.client.http.impl.HttpHeaders; | ||
import org.projectnessie.client.http.impl.HttpRuntimeConfig; | ||
|
@@ -31,7 +35,16 @@ public abstract class HttpRequest | |
protected String accept = "application/json; charset=utf-8"; | ||
|
||
protected HttpRequest(HttpRuntimeConfig config) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can get rid of the single-arg constructor and only use the new one below. WDYT? |
||
this.uriBuilder = new UriBuilder(config.getBaseUri()); | ||
this(config, config.getBaseUri()); | ||
} | ||
|
||
protected HttpRequest(HttpRuntimeConfig config, URI baseUri) { | ||
requireNonNull(baseUri, "Base URI cannot be null"); | ||
checkArgument( | ||
"http".equals(baseUri.getScheme()) || "https".equals(baseUri.getScheme()), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe |
||
"Base URI must be a valid http or https address: %s", | ||
baseUri); | ||
this.uriBuilder = new UriBuilder(baseUri); | ||
this.config = config; | ||
|
||
int clientSpec = config.getClientSpec(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please leave this one