-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add more logging for Help proxy errors #654
Conversation
// Get the headers we need. | ||
let headers = response.headers().clone(); | ||
let content_type = headers.get("content-type"); | ||
|
||
// Log. | ||
log::info!( | ||
"Proxying URL '{:?}' path '{}' content-type is '{:?}'", | ||
"Proxying URL {:?} path '{}' content-type is '{:?}'", |
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.
See how these URLs look in the logs now (too many quotes):
posit-dev/positron#3543 (comment)
crates/ark/src/help_proxy.rs
Outdated
"Got status {} proxying {:?}: {:?}", | ||
response.status().clone().to_string(), | ||
target_url.to_string(), | ||
response.text().await.unwrap(), |
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.
Since something is wrong in this code path, can we confidently say that response
can be properly decoded? Might be better to condition this on Ok()
?
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.
Agreed about the unwrap()
feeling unsafe here since we are in a != reqwest::StatusCode::OK
state here
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.
Thanks, both! Improved in a85e592
crates/ark/src/help_proxy.rs
Outdated
"Got status {} proxying {:?}: {:?}", | ||
response.status().clone().to_string(), | ||
target_url.to_string(), | ||
response.text().await.unwrap(), |
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.
Agreed about the unwrap()
feeling unsafe here since we are in a != reqwest::StatusCode::OK
state here
Addresses posit-dev/positron#3543 by adding some more logging for us to see more detail in what is going on
This PR moves
return HttpResponse::BadGateway().finish()
from where it is now to after some logging we would do anyway, and then also adds logging for the error case (the status code plus just the whole body).