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
default_params with query hash #11
Comments
Sorry I couldn't get to that one yet. Hope to tackle it next week. |
Any luck with this one? |
hey all, |
This got me too. Thanks for the patch @did. |
I'm trying to use this gem with the ActiveCollab API, and it seems certain params need to be in the url (api_auth_token and path_info), and not in the body, meaning I'm unable to upload files. |
Sorry to hear that. For now I've abandoned this gem due to this issue and gone with plain old def method(files)
query = default_params
query.update(
unique_param: "value"
)
uri = URI.parse(base_uri)
uri.path = "/api/path"
uri.query = URI.encode_www_form(query)
uploads = convert_to_upload_io(files)
request = Net::HTTP::Post::Multipart.new(uri.request_uri, file: uploads)
request.add_field('User-Agent', "blah gem #{VERSION}")
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
http.read_timeout = default_options[:timeout]
http.open_timeout = default_options[:timeout]
http.request(request)
end
JSON.parse(response.body)
end |
@maletor First of all: eew. Second of all: What fortunate timing! I've been needing to make multi-part HTTP requests too and I've stumbled across this gem AND this issue. "Wow, an issue that's TWO YEARS OLD! That must be really damn hard to fix." 5 minutes later: https://github.com/radar/httmultiparty/commit/d65d5904fbc4cc08db7b1bc5d034cd5ea9ac201e 2 minutes after that: https://github.com/radar/httmultiparty/commit/97da08e9c29223bc91973913b0d2fc9fa879f75d So yeah. This issue that's been open on this project for two frickin' years is now fixed. Go ahead and use my version if you want. Please merge the below PR, @jwagener. |
Nicely done, @radar. |
@radar Looking at it. Will merge soon |
Returns bad stuff
Returns good stuff
The text was updated successfully, but these errors were encountered: