Skip to content
Merged
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
13 changes: 12 additions & 1 deletion lib/sanity/http/where.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def query_and_variables
else
{}.tap do |hash|
variables.each do |key, value|
hash["$#{key}"] = "\"#{value}\""
hash["$#{key}"] = serialize_variable_value(value)
end
end
end.merge(query: groq_query)
Expand All @@ -56,6 +56,17 @@ def request_body

query_and_variables.to_json
end

def serialize_variable_value(value)
case value
when String
"\"#{value}\""
when Array, Hash
value.to_json
else
value.to_s
end
end
end
end
end