Requesting Base64 encoded URL with Faraday in Ruby on Rails -
i need data server url provided me base64. use faraday connect json apis (which return format). here basic example, including error get:
url = "data:application/json;base64,srighiuerghieurg..." faraday.get(url) #=> uri::invalidurierror: query conflicts opaque opening url in browser yields expected json, how can make work using faraday?
to give idea of structure of request:
curl 'https://some.site.net/1/indexes/*/queries?some-agent=...' -h 'accept: application/json' -h 'accept-encoding: gzip, deflate, br' -h 'accept-language: en-us,en;q=0.5' -h 'connection: keep-alive' -h 'content-type: application/x-www-form-urlencoded' -h 'dnt: 1' -h 'host: some.site.net' -h 'origin: https://another.site.com -h 'referer: https://another.site.com/some/path' -h 'user-agent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, gecko) chrome/42.0.2311.135 safari/537.36 edge/12.10240' --data '{"requests":[{"index":"some-name","params":"some=params"}]}'
https://ruby-doc.org/stdlib-2.2.2/libdoc/base64/rdoc/base64.html
you need split on first , .decode64 on remaining?
Comments
Post a Comment