Giter Site home page Giter Site logo

Some responses not decoded correctly about gibbon HOT 3 CLOSED

amro avatar amro commented on August 20, 2024
Some responses not decoded correctly

from gibbon.

Comments (3)

jlxw avatar jlxw commented on August 20, 2024

also, when posting, the whole JSON string request should be url encoded, not just the values.

My monkey patch below fixes this and the issue in my last post. You also wont need the escape_params function anymore

Gibbon::API.class_eval do
  def call(method, params = {}) #monkey patch to use activesupport json to decode as the other wasn't working
    url = base_api_url + method
    #params = escape_params(@default_params.merge(params))
    params = @default_params.merge(params)
    response = Gibbon::API.post(url, :body => CGI::escape(params.to_json), :timeout => @timeout) #the whole JSON string should be urlencoded, not just the values

    begin
      response = ActiveSupport::JSON.decode(response.body)
    rescue
      response = response.body
    end
    response
  end
end

from gibbon.

amro avatar amro commented on August 20, 2024

Sorry for the delay. I'll get around to doing this shortly. Or, if you want to throw together a pull request, I'll accept it after I test it.

from gibbon.

amro avatar amro commented on August 20, 2024

0.1.6 out. Thanks.

from gibbon.

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.