Skip to content

Commit

Permalink
Refactor HTTP request formatting in IpInfo implementation
Browse files Browse the repository at this point in the history
- Fixes `the borrowed expression implements the required traits`
- Changed string formatting from `format!` to direct string interpolation for POST and GET requests in `ipinfo.rs`.
- This improves readability and maintains consistency in the codebase.
  • Loading branch information
aalkhodiry committed Jan 1, 2025
1 parent 7ed0299 commit b1c1a8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ipinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ impl IpInfo {
) -> Result<HashMap<String, IpDetails>, IpError> {
// Lookup cache misses which are not bogon
let response = client
.post(&format!("{}/batch", BASE_URL))
.post(format!("{}/batch", BASE_URL))
.headers(Self::construct_headers())
.bearer_auth(self.token.as_deref().unwrap_or_default())
.json(&json!(ips))
Expand Down Expand Up @@ -363,7 +363,7 @@ impl IpInfo {
// lookup in case of a cache miss
let response = self
.client
.get(&format!("{}/{}", base_url, ip))
.get(format!("{}/{}", base_url, ip))
.headers(Self::construct_headers())
.bearer_auth(self.token.as_deref().unwrap_or_default())
.send()
Expand Down

0 comments on commit b1c1a8a

Please sign in to comment.