Skip to content

Commit

Permalink
Connection: add Content-Length to #put and #post methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dunn committed Oct 11, 2023
1 parent 9011871 commit 9f3ecd4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/geoserver/publish/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def post(path:, payload:, content_type: "application/json")
response = faraday_connection.post do |req|
req.url path
req.headers["Content-Type"] = content_type
req.headers["Content-Length"] = (payload.length || payload.size || 0).to_s
req.body = payload
end
return true if response.status == 201 || response.status == 401 || response.status == 200
Expand All @@ -39,6 +40,7 @@ def put(path:, payload:, content_type:)
response = faraday_connection.put do |req|
req.url path
req.headers["Content-Type"] = content_type
req.headers["Content-Length"] = (payload.length || payload.size || 0).to_s
req.body = payload
end
return true if response.status == 201 || response.status == 200
Expand Down

0 comments on commit 9f3ecd4

Please sign in to comment.