Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- require 'net/https'
- target_url = 'localhost'
- path = '/issues.xml'
- port = 443
- xml_request =<<EOF
- <?xml version="1.0"?>
- <issue>
- <subject>Example</subject>
- <project_id>33</project_id>
- <priority_id>4</priority_id>
- </issue>
- EOF
- http = Net::HTTP.new(target_url, port)
- http.use_ssl = true
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
- req = Net::HTTP::Post.new(path)
- req.basic_auth("admin", "password")
- req.body = xml_request
- res = http.request(req)
- puts "Finished"
- puts res.code
- puts res.message
- puts res.body
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement