You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
require"json"require"http"structBodyJSON.mapping(
content:String
)
end
server =HTTP::Server.new(8080) do |context|
context.request.body.try do |body|
body =Body.from_json(body)
puts body.content
endend
server.listen
Test using curl -v -d '{"content": "foo"}' http://localhost:8080/.
Expected result: foo printed to server console, HTTP request returns response.
Actual result: CURL hangs after sending data, foo not printed to server stdout. Manually quitting curl with ^C will print foo to the console and complete the HTTP request.
I think something weird is happening with IO::Sized, but I'm not entirely sure whether the blame lies there or in the JSON parsing.
Ugh, another issue because of IO#peek. I think we'll need to revert those changes, it's a mess and it's probably a bad design. I was the only one who though about how to deal with that, so it's better if we revert all of that and think it all over again. Sorry...
Test using
curl -v -d '{"content": "foo"}' http://localhost:8080/
.Expected result:
foo
printed to server console, HTTP request returns response.Actual result: CURL hangs after sending data,
foo
not printed to server stdout. Manually quitting curl with^C
will printfoo
to the console and complete the HTTP request.I think something weird is happening with
IO::Sized
, but I'm not entirely sure whether the blame lies there or in the JSON parsing.The text was updated successfully, but these errors were encountered: