lib/atlassian/stash/pullrequest.rb in atlassian-stash-0.1.3 vs lib/atlassian/stash/pullrequest.rb in atlassian-stash-0.1.4
- old
+ new
@@ -1,7 +1,6 @@
require 'json'
-require 'net/http'
require 'net/https'
require 'uri'
require 'git'
module Atlassian
@@ -68,18 +67,18 @@
title = generate_pull_request_title source, target
description = ''
resource = CreatePullRequestResource.new(repoInfo.projectKey, repoInfo.slug, title, description, reviewers, source, target).resource
- uri = URI.parse(@config["stash_url"])
+ uri = URI.parse(@config["stash_url"].downcase)
prPath = uri.path + '/projects/' + repoInfo.projectKey + '/repos/' + repoInfo.slug + '/pull-requests'
req = Net::HTTP::Post.new(prPath, initheader = {'Content-Type' => 'application/json', 'Accept' => 'application/json'})
req.basic_auth @config["username"], @config["password"]
req.body = resource.to_json
http = Net::HTTP.new(uri.host, uri.port)
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
- http.use_ssl = true
+ http.use_ssl = uri.scheme.eql?("https")
response = http.start {|http| http.request(req) }
if not response.is_a? Net::HTTPCreated
responseBody = JSON.parse(response.body)