Skip to content

Commit 81bca5e

Browse files
fix(client): set User-Agent header in raw HTTP helpers
All three raw HTTP helpers (raw_get, raw_patch, raw_post) were omitting the User-Agent header, causing ddsql (and any other commands using these helpers like acp and synthetics) to send reqwest's default user agent instead of pup's versioned agent string. - Add `useragent::get()` header to raw_get, raw_patch, raw_post Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 919fd10 commit 81bca5e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/client.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ static UNSTABLE_OPS: &[&str] = &[
220220
// Auth type detection
221221
// ---------------------------------------------------------------------------
222222

223+
use crate::useragent;
224+
223225
#[allow(dead_code)]
224226
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
225227
pub enum AuthType {
@@ -506,7 +508,11 @@ pub async fn raw_get(
506508
req = req.query(query);
507509
}
508510

509-
let resp = req.header("Accept", "application/json").send().await?;
511+
let resp = req
512+
.header("Accept", "application/json")
513+
.header("User-Agent", useragent::get())
514+
.send()
515+
.await?;
510516
if !resp.status().is_success() {
511517
let status = resp.status();
512518
let body = resp.text().await.unwrap_or_default();
@@ -539,6 +545,7 @@ pub async fn raw_patch(
539545
let resp = req
540546
.header("Content-Type", "application/json")
541547
.header("Accept", "application/json")
548+
.header("User-Agent", useragent::get())
542549
.json(&body)
543550
.send()
544551
.await?;
@@ -574,6 +581,7 @@ pub async fn raw_post(
574581
let resp = req
575582
.header("Content-Type", "application/json")
576583
.header("Accept", "application/json")
584+
.header("User-Agent", useragent::get())
577585
.json(&body)
578586
.send()
579587
.await?;

0 commit comments

Comments
 (0)