Skip to content

Verbose flag changes what is sent to stdout #437

@christophe-riolo

Description

@christophe-riolo

Hello,
For the context, as part of my work I need to check the headers I send in addition of what I receive as response, so because of that I use the verbose -v flag. I also often pass the output through the jq command, but those are not really compatible because the verbose flag changes the stdout value. Here are some tests I did, removing some headers to make it shorter (forgive the fish shell syntax for piping)

# regulat call sends just the body to STDOUT but everything to STDERR
~> xh  https://jsonplaceholder.typicode.com/todos/1 1>| cat
{
  "userId": 1,
  "id": 1,
  "title": "delectus aut autem",
  "completed": false
}

~> xh  https://jsonplaceholder.typicode.com/todos/1 2>| cat
HTTP/2.0 200 OK
content-type: application/json; charset=utf-8
date: Thu, 11 Dec 2025 08:54:32 GMT
(...)

{
    "userId": 1,
    "id": 1,
    "title": "delectus aut autem",
    "completed": false
}


# With the verbose flag, everything is sent to STDOUT as well as STDERR
~> xh -v https://jsonplaceholder.typicode.com/todos/1 1>| cat
GET /todos/1 HTTP/1.1
Accept-Encoding: gzip, deflate, br, zstd
User-Agent: xh/0.25.0
Connection: keep-alive
Accept: */*
Host: jsonplaceholder.typicode.com

HTTP/2.0 200 OK
date: Thu, 11 Dec 2025 08:55:31 GMT
content-type: application/json; charset=utf-8
(...)

{
  "userId": 1,
  "id": 1,
  "title": "delectus aut autem",
  "completed": false
}

~> xh -v https://jsonplaceholder.typicode.com/todos/1 2>| cat
GET /todos/1 HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate, br, zstd
Connection: keep-alive
Host: jsonplaceholder.typicode.com
User-Agent: xh/0.25.0

HTTP/2.0 200 OK
content-type: application/json; charset=utf-8
date: Thu, 11 Dec 2025 09:00:17 GMT
(...)

{
    "userId": 1,
    "id": 1,
    "title": "delectus aut autem",
    "completed": false
}

This is kinda related to #436 as with that option I could also redirect the request and response headers to STDERR, but I still think it should be seen as a separate issue, as even with the possibility to redirect some parts to STDERR, the default verbose output should probably behave the same as the default output

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions