Skip to content

Header key with underscore being converted to a dash  #641

Closed

Description

@kroe761

I am trying to create a POST request that contains the key app_token in the header. My code

HTTP.headers({:app_token => "some-guid-token"})
         .post("https://service.mycompany.net/",
                     json: { key: "value"})

However, when I make my call, I am notified that app_token was not proved. Looking at the req in HTTP::Client.request, I see that the header has been converted to App-Token. This is causing my request to fail. Is there a workaround? We are using version 4.4.1.

Activity

  1. tarcieri commented on Jan 18, 2021

    @tarcieri
    Member

    Dup of: #337, #576

  2. kroe761 commented on Jan 18, 2021

    @kroe761
    Author

    I've tried this code, and it still results in 'App-Token' as the key in the header

    HTTP.headers({"app_token" => "some-guid-token"})
             .post("https://service.mycompany.net/",
                         json: { key: "value"})
    
  3. tarcieri commented on Jan 18, 2021

    @tarcieri
    Member

    There's a monkeypatch here:

    #337 (comment)

    Otherwise #576 is a more permanent but unreleased fix.

  4. kroe761 commented on Jan 18, 2021

    @kroe761
    Author

    Works perfectly! Thank you!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions