forest_admin_rails 1.10.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 873d01d9795f77f1a69a903f44029537617497ca353651f1202210c5d0d7620a
|
4
|
+
data.tar.gz: 6ebd50868bd3ed263dfcb658ec1c7815af1617b555a4272640b7c81fc9c874ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5eda8996a93b9e2216330dd4f6791b919f7518865a463d246f50f50838771db3a3e03905c77e734fcbc59beab7ffb55bd00cd8d1ab3352384bab78bb1a31f095
|
7
|
+
data.tar.gz: fb12cdced621a5af63577803f0bb9d2402dfe76faae9b6d55ae5a425dac827364196e0070ced5aef27ebea39e2f18c2316d87c8f07640384f917e3d5990ab03f
|
@@ -22,6 +22,9 @@ module ForestAdminRails
|
|
22
22
|
|
23
23
|
def forest_response(data = {})
|
24
24
|
if data[:content].is_a?(Hash)
|
25
|
+
# Handle streaming responses (NEW)
|
26
|
+
return handle_streaming_response(data) if data.dig(:content, :type) == 'Stream'
|
27
|
+
|
25
28
|
if data.dig(:content, :type) == 'File'
|
26
29
|
return send_data data[:content][:stream], filename: data[:content][:name], type: data[:content][:mime_type],
|
27
30
|
disposition: 'attachment'
|
@@ -39,6 +42,24 @@ module ForestAdminRails
|
|
39
42
|
end
|
40
43
|
end
|
41
44
|
|
45
|
+
private
|
46
|
+
|
47
|
+
# Handle streaming response (enumerator-based)
|
48
|
+
def handle_streaming_response(data)
|
49
|
+
enumerator = data[:content][:enumerator]
|
50
|
+
headers = data[:content][:headers] || {}
|
51
|
+
|
52
|
+
# Merge headers
|
53
|
+
response.headers.merge!(headers)
|
54
|
+
|
55
|
+
# Set response status
|
56
|
+
response.status = data[:status] || 200
|
57
|
+
|
58
|
+
# Stream the enumerator
|
59
|
+
# Rails will automatically use chunked transfer encoding
|
60
|
+
self.response_body = enumerator
|
61
|
+
end
|
62
|
+
|
42
63
|
def exception_handler(exception)
|
43
64
|
http_status = get_error_status(exception)
|
44
65
|
|