Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update base_request to properly handle posts #81

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions lib/parliament/request/base_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,16 @@ def post(params: nil, body: nil)
http = Net::HTTP.new(endpoint_uri.host, endpoint_uri.port)
http.use_ssl = true if endpoint_uri.scheme == 'https'

net_response = http.start do |h|
api_request = Net::HTTP::Post.new(endpoint_uri.request_uri)
add_headers(api_request)
api_request.body = body unless body.nil?
request = Net::HTTP::Post.new(
endpoint_uri.request_uri,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use one level of indentation for parameters following the first line of a multi-line method call.
Indent the first parameter one step more than the start of the previous line.

'Content-Type' => 'application/json'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use one level of indentation for parameters following the first line of a multi-line method call.

)

h.request api_request
end
add_headers(request)

request.body = body unless body.nil?

net_response = http.request(request)

handle_errors(net_response)

Expand Down
2 changes: 1 addition & 1 deletion lib/parliament/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Parliament
VERSION = '0.9.0'.freeze
VERSION = '0.10.0'.freeze
end