@@ -5300,44 +5300,72 @@ H1_CLIENT_TEST_CASE(h1_client_write_data_not_enabled) {
53005300 struct tester tester ;
53015301 ASSERT_SUCCESS (s_tester_init (& tester , allocator ));
53025302
5303- struct aws_http_header headers [] = {
5304- {.name = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL ("Content-Length" ),
5305- .value = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL ("5" )},
5306- };
5307-
5308- struct aws_http_message * request = aws_http_message_new_request (allocator );
5309- ASSERT_NOT_NULL (request );
5310- ASSERT_SUCCESS (aws_http_message_set_request_method (request , aws_byte_cursor_from_c_str ("POST" )));
5311- ASSERT_SUCCESS (aws_http_message_set_request_path (request , aws_byte_cursor_from_c_str ("/upload" )));
5312- ASSERT_SUCCESS (aws_http_message_add_header_array (request , headers , AWS_ARRAY_SIZE (headers )));
5313-
5314- struct client_stream_tester stream_tester ;
5315- ASSERT_SUCCESS (client_stream_tester_init (
5316- & stream_tester ,
5317- allocator ,
5318- & (struct client_stream_tester_options ){
5319- .request = request ,
5320- .connection = tester .connection ,
5321- }));
5322-
5323- testing_channel_drain_queued_tasks (& tester .testing_channel );
5324- aws_http_message_destroy (request );
5325-
53265303 /* Try to write data without enabling manual writes */
53275304 struct aws_byte_cursor data = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL ("hello" );
53285305 struct aws_input_stream * input_stream = aws_input_stream_new_from_cursor (allocator , & data );
53295306 ASSERT_NOT_NULL (input_stream );
5330-
53315307 struct aws_http_stream_write_data_options write_options = {
53325308 .data = input_stream ,
53335309 .end_stream = true,
53345310 };
53355311
5336- ASSERT_FAILS (aws_http_stream_write_data (stream_tester .stream , & write_options ));
5337- ASSERT_INT_EQUALS (AWS_ERROR_HTTP_MANUAL_WRITE_NOT_ENABLED , aws_last_error ());
5312+ struct client_stream_tester stream_tester ;
5313+
5314+ {
5315+ struct aws_http_header headers [] = {
5316+ {.name = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL ("Content-Length" ),
5317+ .value = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL ("5" )},
5318+ };
5319+
5320+ struct aws_http_message * request = aws_http_message_new_request (allocator );
5321+ ASSERT_NOT_NULL (request );
5322+ ASSERT_SUCCESS (aws_http_message_set_request_method (request , aws_byte_cursor_from_c_str ("POST" )));
5323+ ASSERT_SUCCESS (aws_http_message_set_request_path (request , aws_byte_cursor_from_c_str ("/upload" )));
5324+ ASSERT_SUCCESS (aws_http_message_add_header_array (request , headers , AWS_ARRAY_SIZE (headers )));
5325+ aws_http_message_set_body_stream (request , input_stream );
5326+
5327+ ASSERT_SUCCESS (client_stream_tester_init (
5328+ & stream_tester ,
5329+ allocator ,
5330+ & (struct client_stream_tester_options ){
5331+ .request = request ,
5332+ .connection = tester .connection ,
5333+ }));
5334+
5335+ testing_channel_drain_queued_tasks (& tester .testing_channel );
5336+
5337+ ASSERT_FAILS (aws_http_stream_write_data (stream_tester .stream , & write_options ));
5338+ ASSERT_INT_EQUALS (AWS_ERROR_HTTP_MANUAL_WRITE_NOT_ENABLED , aws_last_error ());
5339+
5340+ aws_http_message_destroy (request );
5341+ client_stream_tester_clean_up (& stream_tester );
5342+ }
5343+
5344+ {
5345+ struct aws_http_message * request = aws_http_message_new_request (allocator );
5346+ ASSERT_NOT_NULL (request );
5347+ ASSERT_SUCCESS (aws_http_message_set_request_method (request , aws_byte_cursor_from_c_str ("POST" )));
5348+ ASSERT_SUCCESS (aws_http_message_set_request_path (request , aws_byte_cursor_from_c_str ("/upload" )));
5349+
5350+ struct client_stream_tester stream_tester ;
5351+ ASSERT_SUCCESS (client_stream_tester_init (
5352+ & stream_tester ,
5353+ allocator ,
5354+ & (struct client_stream_tester_options ){
5355+ .request = request ,
5356+ .connection = tester .connection ,
5357+ }));
5358+
5359+ testing_channel_drain_queued_tasks (& tester .testing_channel );
5360+
5361+ ASSERT_FAILS (aws_http_stream_write_data (stream_tester .stream , & write_options ));
5362+ ASSERT_INT_EQUALS (AWS_ERROR_HTTP_MANUAL_WRITE_NOT_ENABLED , aws_last_error ());
5363+
5364+ aws_http_message_destroy (request );
5365+ client_stream_tester_clean_up (& stream_tester );
5366+ }
53385367
53395368 aws_input_stream_release (input_stream );
5340- client_stream_tester_clean_up (& stream_tester );
53415369 ASSERT_SUCCESS (s_tester_clean_up (& tester ));
53425370 return AWS_OP_SUCCESS ;
53435371}
@@ -5555,11 +5583,8 @@ H1_CLIENT_TEST_CASE(h1_client_unified_write_data_api) {
55555583 ASSERT_SUCCESS (aws_http_stream_write_data (stream_tester .stream , & write_options ));
55565584 testing_channel_drain_queued_tasks (& tester .testing_channel );
55575585
5558- ASSERT_TRUE (stream_tester .complete );
5559- ASSERT_INT_EQUALS (AWS_ERROR_SUCCESS , stream_tester .on_complete_error_code );
5560-
55615586 const char * expected = "POST /upload HTTP/1.1\r\nContent-Length: 5\r\n\r\nhello" ;
5562- ASSERT_SUCCESS (testing_channel_check_written_message_str (& tester .testing_channel , expected ));
5587+ ASSERT_SUCCESS (testing_channel_check_written_messages_str (& tester .testing_channel , allocator , expected ));
55635588
55645589 aws_input_stream_release (input_stream );
55655590 client_stream_tester_clean_up (& stream_tester );
0 commit comments