Method: Mihari::HTTP#post

Defined in:
lib/mihari/http.rb

#postNet::HTTPResponse

Make a POST request

Returns:

  • (Net::HTTPResponse)


33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/mihari/http.rb', line 33

def post
  post = Net::HTTP::Post.new(url)

  case content_type
  when "application/json"
    post.body = JSON.generate(payload)
  when "application/x-www-form-urlencoded"
    post.set_form_data(payload)
  end

  request post
end