@@ -55,9 +55,9 @@ public function testDoesntOverwriteExpectHeaderIfManuallySet() {
55
55
/**
56
56
* @small
57
57
*/
58
- public function testDoesntSetExpectHeaderIfBodyExactly1MbButProtocolIsnt11 () {
58
+ public function testDoesNotSetEmptyExpectHeaderIfBodyExactly1MbAndProtocolIs11 () {
59
59
$ options = [
60
- 'protocol_version ' => 1.0 ,
60
+ 'protocol_version ' => 1.1 ,
61
61
];
62
62
$ request = Requests::post ($ this ->httpbin ('/post ' ), [], str_repeat ('x ' , 1048576 ), $ this ->getOptions ($ options ));
63
63
@@ -69,7 +69,35 @@ public function testDoesntSetExpectHeaderIfBodyExactly1MbButProtocolIsnt11() {
69
69
/**
70
70
* @small
71
71
*/
72
- public function testSetsEmptyExpectHeaderWithDefaultSettings () {
72
+ public function testDoesNotSetEmptyExpectHeaderIfBodyExactly1MbAndProtocolIs20 () {
73
+ $ options = [
74
+ 'protocol_version ' => 2.0 ,
75
+ ];
76
+ $ request = Requests::post ($ this ->httpbin ('/post ' ), [], str_repeat ('x ' , 1048576 ), $ this ->getOptions ($ options ));
77
+
78
+ $ result = json_decode ($ request ->body , true );
79
+
80
+ $ this ->assertFalse (isset ($ result ['headers ' ]['Expect ' ]));
81
+ }
82
+
83
+ /**
84
+ * @small
85
+ */
86
+ public function testDoesNotSetEmptyExpectHeaderIfBodyExactly1MbAndProtocolIs30 () {
87
+ $ options = [
88
+ 'protocol_version ' => 3.0 ,
89
+ ];
90
+ $ request = Requests::post ($ this ->httpbin ('/post ' , true ), [], str_repeat ('x ' , 1048576 ), $ this ->getOptions ($ options ));
91
+
92
+ $ result = json_decode ($ request ->body , true );
93
+
94
+ $ this ->assertFalse (isset ($ result ['headers ' ]['Expect ' ]));
95
+ }
96
+
97
+ /**
98
+ * @small
99
+ */
100
+ public function testDoesNotSetsEmptyExpectHeaderWithDefaultSettings () {
73
101
$ request = Requests::post ($ this ->httpbin ('/post ' ), [], [], $ this ->getOptions ());
74
102
75
103
$ result = json_decode ($ request ->body , true );
@@ -80,29 +108,38 @@ public function testSetsEmptyExpectHeaderWithDefaultSettings() {
80
108
/**
81
109
* @small
82
110
*/
83
- public function testSetsEmptyExpectHeaderIfBodyIsANestedArrayLessThan1Mb () {
111
+ public function testSetsEmptyExpectHeaderIfBodyIsANestedArrayLessThan1MbAndProtocolIs10 () {
112
+ $ options = [
113
+ 'protocol_version ' => 1.0 ,
114
+ ];
84
115
$ data = [
85
116
str_repeat ('x ' , 148576 ),
86
117
[
87
118
str_repeat ('x ' , 548576 ),
88
119
],
89
120
];
90
- $ request = Requests::post ($ this ->httpbin ('/post ' ), [], $ data , $ this ->getOptions ());
121
+ $ request = Requests::post ($ this ->httpbin ('/post ' ), [], $ data , $ this ->getOptions ($ options ));
91
122
92
123
$ result = json_decode ($ request ->body , true );
93
124
94
125
$ this ->assertFalse (isset ($ result ['headers ' ]['Expect ' ]));
95
126
}
96
127
97
- public function testSetsExpectHeaderIfBodyIsExactlyA1MbString () {
98
- $ request = Requests::post ($ this ->httpbin ('/post ' ), [], str_repeat ('x ' , 1048576 ), $ this ->getOptions ());
128
+ public function testSetsExpectHeaderIfBodyIsExactlyA1MbStringAndProtocolIs10 () {
129
+ $ options = [
130
+ 'protocol_version ' => 1.0 ,
131
+ ];
132
+ $ request = Requests::post ($ this ->httpbin ('/post ' ), [], str_repeat ('x ' , 1048576 ), $ this ->getOptions ($ options ));
99
133
100
134
$ result = json_decode ($ request ->body , true );
101
135
102
136
$ this ->assertSame ('100-Continue ' , $ result ['headers ' ]['Expect ' ]);
103
137
}
104
138
105
- public function testSetsExpectHeaderIfBodyIsANestedArrayGreaterThan1Mb () {
139
+ public function testSetsExpectHeaderIfBodyIsANestedArrayGreaterThan1MbAndProtocolIs10 () {
140
+ $ options = [
141
+ 'protocol_version ' => 1.0 ,
142
+ ];
106
143
$ data = [
107
144
str_repeat ('x ' , 148576 ),
108
145
[
@@ -112,15 +149,18 @@ public function testSetsExpectHeaderIfBodyIsANestedArrayGreaterThan1Mb() {
112
149
],
113
150
],
114
151
];
115
- $ request = Requests::post ($ this ->httpbin ('/post ' ), [], $ data , $ this ->getOptions ());
152
+ $ request = Requests::post ($ this ->httpbin ('/post ' ), [], $ data , $ this ->getOptions ($ options ));
116
153
117
154
$ result = json_decode ($ request ->body , true );
118
155
119
156
$ this ->assertSame ('100-Continue ' , $ result ['headers ' ]['Expect ' ]);
120
157
}
121
158
122
- public function testSetsExpectHeaderIfBodyExactly1Mb () {
123
- $ request = Requests::post ($ this ->httpbin ('/post ' ), [], str_repeat ('x ' , 1048576 ), $ this ->getOptions ());
159
+ public function testSetsExpectHeaderIfBodyExactly1MbAndProtocolIs10 () {
160
+ $ options = [
161
+ 'protocol_version ' => 1.0 ,
162
+ ];
163
+ $ request = Requests::post ($ this ->httpbin ('/post ' ), [], str_repeat ('x ' , 1048576 ), $ this ->getOptions ($ options ));
124
164
125
165
$ result = json_decode ($ request ->body , true );
126
166
@@ -130,8 +170,11 @@ public function testSetsExpectHeaderIfBodyExactly1Mb() {
130
170
/**
131
171
* @small
132
172
*/
133
- public function testSetsEmptyExpectHeaderIfBodySmallerThan1Mb () {
134
- $ request = Requests::post ($ this ->httpbin ('/post ' ), [], str_repeat ('x ' , 1048575 ), $ this ->getOptions ());
173
+ public function testSetsEmptyExpectHeaderIfBodySmallerThan1MbAndProtocolIs10 () {
174
+ $ options = [
175
+ 'protocol_version ' => 1.0 ,
176
+ ];
177
+ $ request = Requests::post ($ this ->httpbin ('/post ' ), [], str_repeat ('x ' , 1048575 ), $ this ->getOptions ($ options ));
135
178
136
179
$ result = json_decode ($ request ->body , true );
137
180
0 commit comments