11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/gitlab/ci/lint/client.rb', line 11
def post url, content, ={ "Content-Type" => "application/json"}, timeout=10
begin
if content = GitLab::CI::Lint::YMLReader.new(content).get_json_content()
body = { content: content }.to_json
request = self.class.post(url, :body => body, :headers => )
if request.code == 200
puts "\nSuccessful request!"
return JSON.parse(request.body)
else
puts "Error - Bad Request #{request.code}"
exit
end
else
puts "\nError - No Content..."
exit
end
rescue => error
puts "\nError Post - #{error}"
end
end
|