Giter Club home page Giter Club logo

Comments (4)

cap10morgan avatar cap10morgan commented on June 21, 2024

This is fixed here: http://github.com/cap10morgan/httparty/compare/master...response_header_case_bug

from httparty.

sandro avatar sandro commented on June 21, 2024

Thanks for the patch. Generally, I'd love it if HTTParty::Response was more API-compatible with Net::HTTPResponse and this issue is bringing us a little closer to that. While your patch fixes the case-sensitivity issue we'd still be returning a simple hash instead something that acts more like an HTTPResponse object.

In this example, accessing the set-cookie header returns an array when it's accessed through HTTParty while Net::HTTP returns a comma delimited string.

>> r = HTTParty.get('http://github.com'); r.headers['set-cookie']
=> ["csrf_id=5bfd378ae7f1418ef00df0361b2cb5d7; path=/", "_github_ses=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--884981fc5aa85daf318eeff084d98e2cff92578f; path=/; expires=Wed, 01 Jan 2020 08:00:00 GMT; HttpOnly"]
>>
>> r = Net::HTTP.get_response(URI.parse('http://github.com')); r['set-cookie']
=> "csrf_id=bdceb42a51453f0f6f9ee8d2b5acd98a; path=/, _github_ses=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--884981fc5aa85daf318eeff084d98e2cff92578f; path=/; expires=Wed, 01 Jan 2020 08:00:00 GMT; HttpOnly"

I'm almost finished , just wanted to give you some context on why I'm moving towards another solution.

from httparty.

cap10morgan avatar cap10morgan commented on June 21, 2024

Sounds good to me. Thanks for the explanation.

from httparty.

sandro avatar sandro commented on June 21, 2024

Response headers accessible with mixed-case keys

HTTParty::Response#response now returns the Net::HTTPResponse object for
the request. Method missing now attempts to call the missing method on the
HTTPResponse object when it doesn't exist on the parsed response
object, i.e.
HTTParty.get('http://example.com').get_fields('content-type')

Closed by 179ef87

from httparty.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.