-
Notifications
You must be signed in to change notification settings - Fork 196
Enable using base URLs with path extensions #1225
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| livekit-api: patch | ||
| --- | ||
|
|
||
| fix: enable using base URLs with path extensions |
|
Johennes marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,7 @@ use thiserror::Error; | |
| use url::Url; | ||
|
|
||
| use super::failover::{self, FailoverConfig}; | ||
| use crate::http_client; | ||
| use crate::{http_client, url_with_path_suffix}; | ||
|
|
||
| pub const DEFAULT_PREFIX: &str = "/twirp"; | ||
|
|
||
|
|
@@ -215,7 +215,6 @@ impl TwirpClient { | |
| timeout: Duration, | ||
| ) -> ServerResult<R> { | ||
| let original = Url::parse(&self.host)?; | ||
| let path = format!("{}/{}.{}/{}", self.prefix, self.pkg, service, method); | ||
| headers.insert(USER_AGENT, HeaderValue::from_static(USER_AGENT_VALUE)); | ||
| #[cfg(test)] | ||
| for (k, v) in &self.default_headers { | ||
|
|
@@ -232,8 +231,10 @@ impl TwirpClient { | |
|
|
||
| for attempt in 0..max_attempts { | ||
| let is_last = attempt + 1 >= max_attempts; | ||
| let mut url = current.clone(); | ||
| url.set_path(&path); | ||
| let url = url_with_path_suffix( | ||
| ¤t, | ||
| &format!("{}/{}.{}/{}", self.prefix, self.pkg, service, method), | ||
| ); | ||
|
Comment on lines
+234
to
+237
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. 🔍 Failover region URLs will not inherit the original base path When a request fails over to a region URL, Was this helpful? React with 👍 or 👎 to provide feedback.
Author
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 this is fine because |
||
|
|
||
| let send = self | ||
| .client | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.