Skip to content

Instantly share code, notes, and snippets.

@frizop
Created January 9, 2020 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frizop/fd3bb44650414d49fead30c4e8d86201 to your computer and use it in GitHub Desktop.
Save frizop/fd3bb44650414d49fead30c4e8d86201 to your computer and use it in GitHub Desktop.
http_post
def http_post(uri, form_data, crumb)
key, value = crumb.split(":")
uri = URI(uri)
request = Net::HTTP::Post.new(uri)
request.basic_auth '', ''
request[key] = value
request.set_form form_data, 'multipart/form-data'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: false) do |http|
http.request(request)
end
# binding.pry
response.body
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment