Skip to content

Commit f3d8bb7

Browse files
committed
feat: automatically send empty body for end request, also add support for ruby 4.0+
1 parent a768620 commit f3d8bb7

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

lib/stagehand/internal/util.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,12 @@ class << self
272272
#
273273
# @return [Hash{String=>Array<String>}]
274274
def decode_query(query)
275-
CGI.parse(query.to_s)
275+
return {} if query.nil? || query.empty?
276+
277+
# Use URI.decode_www_form for Ruby 3.2+ and 4.0+ compatibility
278+
URI.decode_www_form(query.to_s).each_with_object({}) do |(key, value), hash|
279+
(hash[key] ||= []) << value
280+
end
276281
end
277282

278283
# @api private

lib/stagehand/resources/sessions.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def end_(id, params = {})
140140
x_sent_at: "x-sent-at",
141141
x_stream_response: "x-stream-response"
142142
),
143+
body: {},
143144
model: Stagehand::Models::SessionEndResponse,
144145
options: options
145146
)

0 commit comments

Comments
 (0)