Skip to content

Logger outputs canonicalised request headers, rather than logging what is sent #600

Closed

Description

@unikitty37
logger = Logger.new(STDERR)
http_headers = {
  'TEST_ONE' => 1,
  'TEST.TWO' => 2
}
HTTP.headers(http_headers)
    .use(logging: {logger: logger})
    .use(:auto_inflate).headers('Accept-Encoding' => 'gzip')
    .post('https://example.com')

produces this:

I, [2020-03-12T15:51:28.560383 #1]  INFO -- : > POST https://example.com
D, [2020-03-12T15:51:28.560482 #1] DEBUG -- : Test-One: 1
Test.two: 2
Accept-Encoding: gzip
Connection: close
Host: example.com
User-Agent: http.rb/4.3.0

While #576 means the header should be sent as specified in http_headers, it's difficult to confirm this from the logger output! Could the logger output the unaltered header instead, please?

(It would also be useful if it could output a newline before that first header — it tends to get lost in the noise of the timestamp line 🙂)

Activity

  1. sferik commented on Mar 11, 2026

    @sferik
    Contributor

    I tried writing tests to reproduce the issue but could not. I believe it was fixed in #576. Please feel free to reopen this issue if I’m mistaken about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions