-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Monkeypatch to pass array params without an index
typhoeus/typhoeus#320 We were seeing array params tranformed into the following: /event?groups[0]=open-forum&groups[1]=armory-films but we need the client to send array params to various API services in the following (valid) format: /event?groups[]=open-forum&groups[]=armory-films
- Loading branch information
1 parent
22f6116
commit 548033a
Showing
2 changed files
with
6 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
548033a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dylanfareed Do you remember this? What was the reason not to PR this upstream to typhoeus?
548033a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember fully (4 years!), but I agree that, if they'd accept the change upstream in Ethon (maybe using a config/opt to define the array encoding strategy), that's a better path forward.
The source commit here references the issue on their end(s):
#52 (comment)
typhoeus/typhoeus#320
548033a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So ethon now has
params_encoding
and takes:rack
to make it this way, see https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L101. This was added in #104.Still trying to track down where we actually need this change, what API and from where is being used that causes a failure.
548033a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome. That's great that that is now available in ethon. If I recall correctly, the monkeypatch was introduced so that the rails adapter library we were writing (whose name escapes me now) could encode array params for sub resources like "events" associated with a "show" in a manner that Gravity's API could parse natively. I'm not sure if that's what you are asking...
548033a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit comment here provides some clues as to which Gravity endpoints we were concerned about