Sha256: 9f9b7970ad53c4e4528edcc317ad76e48a87941bf39019d6441712d2c2440c6b

Contents?: true

Size: 456 Bytes

Versions: 3

Compression:

Stored size: 456 Bytes

Contents

require 'net/http'

module ShopifyCli
  class HttpRequest
    def self.call(uri, body, variables, headers)
      http = ::Net::HTTP.new(uri.host, uri.port)
      http.use_ssl = true
      req = ::Net::HTTP::Post.new(uri.request_uri)
      req.body = JSON.dump(query: body.tr("\n", ""), variables: variables)
      req['Content-Type'] = 'application/json'
      headers.each { |header, value| req[header] = value }
      http.request(req)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shopify-cli-1.5.0 lib/shopify-cli/http_request.rb
shopify-cli-1.4.1 lib/shopify-cli/http_request.rb
shopify-cli-1.4.0 lib/shopify-cli/http_request.rb