@@ -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,37 @@ 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
+ 'timeout ' => 30 ,
90
+ 'connect_timeout ' => 30
91
+ ];
92
+ $ request = Requests::post ($ this ->httpbin ('/post ' , true ), [], str_repeat ('x ' , 1048576 ), $ this ->getOptions ($ options ));
93
+
94
+ $ result = json_decode ($ request ->body , true );
95
+
96
+ $ this ->assertFalse (isset ($ result ['headers ' ]['Expect ' ]));
97
+ }
98
+
99
+ /**
100
+ * @small
101
+ */
102
+ public function testDoesNotSetsEmptyExpectHeaderWithDefaultSettings () {
73
103
$ request = Requests::post ($ this ->httpbin ('/post ' ), [], [], $ this ->getOptions ());
74
104
75
105
$ result = json_decode ($ request ->body , true );
@@ -80,29 +110,38 @@ public function testSetsEmptyExpectHeaderWithDefaultSettings() {
80
110
/**
81
111
* @small
82
112
*/
83
- public function testSetsEmptyExpectHeaderIfBodyIsANestedArrayLessThan1Mb () {
113
+ public function testSetsEmptyExpectHeaderIfBodyIsANestedArrayLessThan1MbAndProtocolIs10 () {
114
+ $ options = [
115
+ 'protocol_version ' => 1.0 ,
116
+ ];
84
117
$ data = [
85
118
str_repeat ('x ' , 148576 ),
86
119
[
87
120
str_repeat ('x ' , 548576 ),
88
121
],
89
122
];
90
- $ request = Requests::post ($ this ->httpbin ('/post ' ), [], $ data , $ this ->getOptions ());
123
+ $ request = Requests::post ($ this ->httpbin ('/post ' ), [], $ data , $ this ->getOptions ($ options ));
91
124
92
125
$ result = json_decode ($ request ->body , true );
93
126
94
127
$ this ->assertFalse (isset ($ result ['headers ' ]['Expect ' ]));
95
128
}
96
129
97
- public function testSetsExpectHeaderIfBodyIsExactlyA1MbString () {
98
- $ request = Requests::post ($ this ->httpbin ('/post ' ), [], str_repeat ('x ' , 1048576 ), $ this ->getOptions ());
130
+ public function testSetsExpectHeaderIfBodyIsExactlyA1MbStringAndProtocolIs10 () {
131
+ $ options = [
132
+ 'protocol_version ' => 1.0 ,
133
+ ];
134
+ $ request = Requests::post ($ this ->httpbin ('/post ' ), [], str_repeat ('x ' , 1048576 ), $ this ->getOptions ($ options ));
99
135
100
136
$ result = json_decode ($ request ->body , true );
101
137
102
138
$ this ->assertSame ('100-Continue ' , $ result ['headers ' ]['Expect ' ]);
103
139
}
104
140
105
- public function testSetsExpectHeaderIfBodyIsANestedArrayGreaterThan1Mb () {
141
+ public function testSetsExpectHeaderIfBodyIsANestedArrayGreaterThan1MbAndProtocolIs10 () {
142
+ $ options = [
143
+ 'protocol_version ' => 1.0 ,
144
+ ];
106
145
$ data = [
107
146
str_repeat ('x ' , 148576 ),
108
147
[
@@ -112,15 +151,18 @@ public function testSetsExpectHeaderIfBodyIsANestedArrayGreaterThan1Mb() {
112
151
],
113
152
],
114
153
];
115
- $ request = Requests::post ($ this ->httpbin ('/post ' ), [], $ data , $ this ->getOptions ());
154
+ $ request = Requests::post ($ this ->httpbin ('/post ' ), [], $ data , $ this ->getOptions ($ options ));
116
155
117
156
$ result = json_decode ($ request ->body , true );
118
157
119
158
$ this ->assertSame ('100-Continue ' , $ result ['headers ' ]['Expect ' ]);
120
159
}
121
160
122
- public function testSetsExpectHeaderIfBodyExactly1Mb () {
123
- $ request = Requests::post ($ this ->httpbin ('/post ' ), [], str_repeat ('x ' , 1048576 ), $ this ->getOptions ());
161
+ public function testSetsExpectHeaderIfBodyExactly1MbAndProtocolIs10 () {
162
+ $ options = [
163
+ 'protocol_version ' => 1.0 ,
164
+ ];
165
+ $ request = Requests::post ($ this ->httpbin ('/post ' ), [], str_repeat ('x ' , 1048576 ), $ this ->getOptions ($ options ));
124
166
125
167
$ result = json_decode ($ request ->body , true );
126
168
@@ -130,8 +172,11 @@ public function testSetsExpectHeaderIfBodyExactly1Mb() {
130
172
/**
131
173
* @small
132
174
*/
133
- public function testSetsEmptyExpectHeaderIfBodySmallerThan1Mb () {
134
- $ request = Requests::post ($ this ->httpbin ('/post ' ), [], str_repeat ('x ' , 1048575 ), $ this ->getOptions ());
175
+ public function testSetsEmptyExpectHeaderIfBodySmallerThan1MbAndProtocolIs10 () {
176
+ $ options = [
177
+ 'protocol_version ' => 1.0 ,
178
+ ];
179
+ $ request = Requests::post ($ this ->httpbin ('/post ' ), [], str_repeat ('x ' , 1048575 ), $ this ->getOptions ($ options ));
135
180
136
181
$ result = json_decode ($ request ->body , true );
137
182
0 commit comments