File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ # Released under the MIT License.
4+ # Copyright, 2018-2024, by Samuel Williams.
5+
6+ require "sus/fixtures/async/http"
7+
8+ APostRequest = Sus ::Shared ( "a post request" ) do
9+ include Sus ::Fixtures ::Async ::HTTP ::ServerContext
10+
11+ let ( :app ) do
12+ ::Protocol ::HTTP ::Middleware . for do |request |
13+ ::Protocol ::HTTP ::Response [ 200 , { } , request . body ]
14+ end
15+ end
16+
17+ it "can post a fixed length body" do
18+ body = Protocol ::HTTP ::Body ::Buffered . wrap ( [ "Hello, World!" ] )
19+
20+ begin
21+ response = client . post ( "/" , body : body )
22+
23+ expect ( response ) . to be ( :success? )
24+ expect ( response . read ) . to be == "Hello, World!"
25+ ensure
26+ response &.finish
27+ end
28+ end
29+ end
30+
31+ describe Async ::HTTP ::Protocol ::HTTP10 do
32+ it_behaves_like APostRequest
33+ end
34+
35+ describe Async ::HTTP ::Protocol ::HTTP11 do
36+ it_behaves_like APostRequest
37+ end
38+
39+ describe Async ::HTTP ::Protocol ::HTTP2 do
40+ it_behaves_like APostRequest
41+ end
You can’t perform that action at this time.
0 commit comments