Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add :data_format to use set_form_data vs json body? [lib/watson/remote.rb] #84

Open
nhmood opened this issue Nov 21, 2013 · 0 comments
Open

Comments

@nhmood
Copy link
Owner

nhmood commented Nov 21, 2013

filename : lib/watson/remote.rb
line # : 88
tag : review
md5 : 88fbf45c55d9c0d76128faaf1de92dc8

        # [review] - Add :data_format to use set_form_data vs json body?
        # For now, use Hash or Array, this is to differentiate between 
        # putting post data in body vs putting it in the form

        # If a POST method, :data is present, and is a Hash, fill request body with data
        if opts[:method].upcase == "POST" && opts[:data] && opts[:data].is_a?(Hash)
            _req.body = opts[:data].to_json
        end
            # If a POST method, :data is present, and is an Array, use set_form_data
        if opts[:method].upcase == "POST" && opts[:data] && opts[:data].is_a?(Array)
            _req.set_form_data(opts[:data][0])
        end
            # Make HTTP request
        _resp = _http.request(_req)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant