Skip to content

Commit 5ebe59d

Browse files
fix(client): send content-type header for requests with an omitted optional body
1 parent 017c72c commit 5ebe59d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/lithic/internal/transport/base_client.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,10 @@ def initialize(
306306
Lithic::Internal::Util.deep_merge(*[req[:body], opts[:extra_body]].compact)
307307
end
308308

309-
headers.delete("content-type") if body.nil?
309+
# Generated methods always pass `req[:body]` for operations that define a
310+
# request body, so only elide the content-type header when the operation
311+
# has no body at all, not when an optional body param was omitted.
312+
headers.delete("content-type") if body.nil? && !req.key?(:body)
310313

311314
url = Lithic::Internal::Util.join_parsed_uri(
312315
@base_url_components,

0 commit comments

Comments
 (0)