Skip to content

Commit

Permalink
fix typos, add github action (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
oriontvv authored Mar 12, 2024
1 parent d20903e commit 2a3f239
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 10 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ jobs:
command: clippy
args: --all-targets --features ${{ matrix.otel_version }} --workspace -- -D warnings

typos:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- name: Check spelling
uses: crate-ci/typos@master

docs:
name: Docs
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ implementations. This repository also contains a couple of useful concrete middl
* [`reqwest-tracing`](https://crates.io/crates/reqwest-tracing):
[`tracing`](https://crates.io/crates/tracing) integration, optional opentelemetry support.

Note about browser support: automated tests targetting wasm are disabled. The crate may work with
Note about browser support: automated tests targeting wasm are disabled. The crate may work with
wasm but wasm support is unmaintained. PRs improving wasm are still welcome but you'd need to
reintroduce the tests and get them passing before we'd merge it (see
https://github.com/TrueLayer/reqwest-middleware/pull/105).
Expand Down
2 changes: 1 addition & 1 deletion reqwest-retry/src/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ where
next: Next<'_>,
) -> Result<Response> {
// TODO: Ideally we should create a new instance of the `Extensions` map to pass
// downstream. This will guard against previous retries poluting `Extensions`.
// downstream. This will guard against previous retries polluting `Extensions`.
// That is, we only return what's populated in the typemap for the last retry attempt
// and copy those into the the `global` Extensions map.
self.execute_with_retry(req, next, extensions).await
Expand Down
2 changes: 1 addition & 1 deletion reqwest-retry/src/retryable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use reqwest_middleware::Error;
/// Classification of an error/status returned by request.
#[derive(PartialEq, Eq)]
pub enum Retryable {
/// The failure was due to something tha might resolve in the future.
/// The failure was due to something that might resolve in the future.
Transient,
/// Unresolvable error.
Fatal,
Expand Down
4 changes: 2 additions & 2 deletions reqwest-retry/src/retryable_strategy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ use reqwest_middleware::Error;
/// let retry_policy = ExponentialBackoff::builder()
/// .build_with_max_retries(2);
///
/// // Create the actual middleware, with the exponential backoff and custom retry stategy.
/// // Create the actual middleware, with the exponential backoff and custom retry strategy.
/// let ret_s = RetryTransientMiddleware::new_with_policy_and_strategy(
/// retry_policy,
/// Retry201,
Expand Down Expand Up @@ -154,7 +154,7 @@ pub fn default_on_request_failure(error: &Error) -> Option<Retryable> {
#[cfg(not(target_arch = "wasm32"))]
if let Some(hyper_error) = get_source_error_type::<hyper::Error>(&error) {
// The hyper::Error(IncompleteMessage) is raised if the HTTP response is well formatted but does not contain all the bytes.
// This can happen when the server has started sending back the response but the connection is cut halfway thorugh.
// This can happen when the server has started sending back the response but the connection is cut halfway through.
// We can safely retry the call, hence marking this error as [`Retryable::Transient`].
// Instead hyper::Error(Canceled) is raised when the connection is
// gracefully closed on the server side.
Expand Down
6 changes: 3 additions & 3 deletions reqwest-retry/tests/all/retry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ macro_rules! assert_retry_succeeds_inner {
macro_rules! assert_retry_succeeds {
($x:tt, $status:expr) => {
paste! {
assert_retry_succeeds_inner!($x, [<assert_retry_succeds_on_ $x>], $status, 3, 2, RetryResponder::new(3 as u32, $x));
assert_retry_succeeds_inner!($x, [<assert_retry_succeeds_on_ $x>], $status, 3, 2, RetryResponder::new(3 as u32, $x));
}
};
}
Expand Down Expand Up @@ -275,7 +275,7 @@ async fn assert_retry_on_hyper_canceled() {
let mut buffer = Vec::new();
stream.read_buf(&mut buffer).await.unwrap();
if counter.fetch_add(1, Ordering::SeqCst) > 1 {
// This triggeres hyper:Error(Canceled).
// This triggers hyper:Error(Canceled).
let _res = stream
.into_std()
.unwrap()
Expand Down Expand Up @@ -326,7 +326,7 @@ async fn assert_retry_on_connection_reset_by_peer() {
let mut buffer = Vec::new();
stream.read_buf(&mut buffer).await.unwrap();
if counter.fetch_add(1, Ordering::SeqCst) > 1 {
// This triggeres hyper:Error(Io, io::Error(ConnectionReset)).
// This triggers hyper:Error(Io, io::Error(ConnectionReset)).
drop(stream);
} else {
let _res = stream.write("HTTP/1.1 200 OK\r\n\r\n".as_bytes()).await;
Expand Down
2 changes: 1 addition & 1 deletion reqwest-tracing/src/reqwest_otel_span_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub const HTTP_USER_AGENT: &str = "http.user_agent";
///
/// [`TracingMiddleware`]: crate::middleware::TracingMiddleware.
pub trait ReqwestOtelSpanBackend {
/// Initalized a new span before the request is executed.
/// Initialized a new span before the request is executed.
fn on_request_start(req: &Request, extension: &mut Extensions) -> Span;

/// Runs after the request call has executed.
Expand Down
2 changes: 1 addition & 1 deletion reqwest-tracing/src/reqwest_otel_span_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
/// If nothing else is specified, the span generated by `reqwest_otel_span!` is identical to the one you'd
/// get by using [`DefaultSpanBackend`]. Note that to avoid leaking sensitive information, the
/// macro doesn't include `http.url`, even though it's required by opentelemetry. You can add the
/// URL attribute explicitly by usng [`SpanBackendWithUrl`] instead of `DefaultSpanBackend` or
/// URL attribute explicitly by using [`SpanBackendWithUrl`] instead of `DefaultSpanBackend` or
/// adding the field on your own implementation.
///
/// You can define new fields following the same syntax of [`tracing::info_span!`] for fields:
Expand Down

0 comments on commit 2a3f239

Please sign in to comment.