Skip to content

bug in the http_client.rb code in 4.0.0 build_request method - modified request is not returned if params not empty and submit method allowed #85

Description

@qvrb

in the following code the request object is not modified or returned in the case where the SUBMIT_METHODS & params not empty in http_client.c

62     def build_request(method, uri, params = {})
63       # Construct the HTTP request.
64       raise MethodNotAllowedException unless ALLOWED_METHODS.include?(method)
65
66       request = Class.const_get("Net::HTTP::#{method.to_s.capitalize}").new(uri.request_uri)
67
68       request['Accept']        = 'application/json'
69       request['Authorization'] = "AccessKey #{@access_key}"
70       request['User-Agent']    = "MessageBird/ApiClient/#{Version::STRING} Ruby/#{RUBY_VERSION}"
71       if SUBMIT_METHODS.include?(method) && !params.empty?
72         prepare_request(request, params)
73       end
74       request
75     end

The code on line 72 should read
request = prepare_request(request, params)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions