We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 23cd58a commit d0df4abCopy full SHA for d0df4ab
1 file changed
spec/requests/server_components_spec.rb
@@ -1,6 +1,7 @@
1
# frozen_string_literal: true
2
3
require "rails_helper"
4
+require "react_on_rails/length_prefixed_parser"
5
6
describe "Server Components" do
7
it "GET /server-components returns the demo page shell" do
@@ -11,12 +12,11 @@
11
12
13
describe "RSC payload endpoint" do
14
def parsed_chunks
- response.body.each_line.filter_map do |line|
15
- stripped = line.strip
16
- next if stripped.empty?
17
-
18
- JSON.parse(stripped)
19
- end
+ chunks = []
+ parser = ReactOnRails::LengthPrefixedParser.new
+ parser.feed(response.body.b) { |chunk| chunks << chunk }
+ parser.flush
+ chunks
20
end
21
22
def expect_valid_rsc_payload
0 commit comments