mirror of
https://github.com/TrueLayer/reqwest-middleware.git
synced 2024-12-26 02:46:30 +00:00
fix: test compilation
This commit is contained in:
parent
3422e7338c
commit
09189ab63e
2 changed files with 9 additions and 2 deletions
|
@ -2,7 +2,7 @@ use std::borrow::Cow;
|
||||||
|
|
||||||
use http::Extensions;
|
use http::Extensions;
|
||||||
use matchit::Router;
|
use matchit::Router;
|
||||||
use reqwest::{header::HeaderValue, Request, Response, StatusCode as RequestStatusCode, Url};
|
use reqwest::{Request, Response, StatusCode as RequestStatusCode, Url};
|
||||||
use reqwest_middleware::{Error, Result};
|
use reqwest_middleware::{Error, Result};
|
||||||
use tracing::{warn, Span};
|
use tracing::{warn, Span};
|
||||||
|
|
||||||
|
@ -344,6 +344,13 @@ fn remove_credentials(url: &Url) -> Cow<'_, str> {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
use reqwest::header::{HeaderMap, HeaderValue};
|
||||||
|
|
||||||
|
fn get_header_value(key: &str, headers: &HeaderMap) -> String {
|
||||||
|
let header_default = &HeaderValue::from_static("");
|
||||||
|
format!("{:?}", headers.get(key).unwrap_or(header_default)).replace('"', "")
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn get_header_value_for_span_attribute() {
|
fn get_header_value_for_span_attribute() {
|
||||||
let expect = "IMPORTANT_HEADER";
|
let expect = "IMPORTANT_HEADER";
|
||||||
|
|
|
@ -125,7 +125,7 @@ macro_rules! reqwest_otel_span {
|
||||||
let host = url.host_str().unwrap_or("");
|
let host = url.host_str().unwrap_or("");
|
||||||
let host_port = url.port_or_known_default().unwrap_or(0) as i64;
|
let host_port = url.port_or_known_default().unwrap_or(0) as i64;
|
||||||
let otel_name = $name.to_string();
|
let otel_name = $name.to_string();
|
||||||
let header_default = &HeaderValue::from_static("");
|
let header_default = &::http::HeaderValue::from_static("");
|
||||||
let user_agent = format!("{:?}", $request.headers().get("user_agent").unwrap_or(header_default)).replace('"', "");
|
let user_agent = format!("{:?}", $request.headers().get("user_agent").unwrap_or(header_default)).replace('"', "");
|
||||||
|
|
||||||
macro_rules! request_span {
|
macro_rules! request_span {
|
||||||
|
|
Loading…
Reference in a new issue