Method: Hub::GitHubAPI::HttpMethods#post

Defined in:
lib/hub/github_api.rb

#post(url, params = nil) ⇒ Object



138
139
140
141
142
143
144
145
146
147
# File 'lib/hub/github_api.rb', line 138

def post url, params = nil
  perform_request url, :Post do |req|
    if params
      req.body = JSON.dump params
      req['Content-Type'] = 'application/json'
    end
    yield req if block_given?
    req['Content-Length'] = req.body ? req.body.length : 0
  end
end