module HTTPUtils

all utilities for dealing with http-related things

Public Class Methods

make_proper_request(client, request) click to toggle source
# File lib/utils/http_utils.rb, line 93
def self.make_proper_request(client, request)
  headers = HeaderUtils.get_headers(client)
  data = HeaderUtils.get_req_data(client, headers)
  method = request.split(' ')[0]
  url = request.split(' ')[1]
  proto = request.split(' ')[2]

  { headers: headers, data: data, method: method, url: url, protocol: proto }
end
make_request_object(req) click to toggle source
# File lib/utils/http_utils.rb, line 103
def self.make_request_object(req)
  req[:data] = '{}' if req[:data].nil?

  {
    headers: req[:headers],
    data: JSON.parse(req[:data]),
    method: req[:method],
    url: req[:url],
    protocol: req[:protocol]
  }
end