Skip to content

Commit

Permalink
fix(server): proxy query string
Browse files Browse the repository at this point in the history
  • Loading branch information
gc-victor committed Nov 10, 2023
1 parent 140265e commit 228ac87
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "query"
version = "0.3.1"
version = "0.3.2-prerelease"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use tracing_subscriber::FmtSubscriber;

#[derive(Parser)]
#[command(name = "Query")]
#[command(version = "0.3.1")]
#[command(version = "0.3.2-prerelease")]
#[command(about = "The CLI to manage your Query Server instance", long_about = None)]
struct Cli {
#[command(subcommand)]
Expand Down
2 changes: 1 addition & 1 deletion crates/server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "query-server"
version = "0.3.1"
version = "0.3.2-prerelease"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
7 changes: 6 additions & 1 deletion crates/server/src/controllers/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ use super::utils::http_error::HttpError;
#[instrument(err(Debug), skip(req))]
pub async fn proxy(req: &mut Request<Body>) -> Result<Response<Body>, HttpError> {
let path = req.uri().path().to_string();
let target_url = format!("http://localhost:{}{}", Env::proxy_port(), path);
let query = match req.uri().query() {
Some(query) => format!("?{}", query.to_string()),
None => "".to_string(),
};
let target_url = format!("http://localhost:{}{}{}", Env::proxy_port(), path, query);

let headers = req.headers().clone();
let body_bytes = match hyper::body::to_bytes(req.body_mut()).await {
Ok(body_bytes) => body_bytes,
Expand Down

0 comments on commit 228ac87

Please sign in to comment.