@@ -20,21 +20,10 @@ public function makeRequest(string $url, string $method, array $values, array $a
20
20
{
21
21
list ($ postFields , $ getFields , $ cookieFields , $ rawPost , $ putFields ) = $ this ->processValues ($ values );
22
22
23
- if (isset ($ additionalValues ['postFields ' ])) {
24
- $ postFields = array_merge ($ postFields , $ additionalValues ['postFields ' ]);
25
- }
26
-
27
- if (isset ($ additionalValues ['getFields ' ])) {
28
- $ getFields = array_merge ($ postFields , $ additionalValues ['getFields ' ]);
29
- }
30
-
31
- if (isset ($ additionalValues ['cookieFields ' ])) {
32
- $ cookieFields = array_merge ($ postFields , $ additionalValues ['cookieFields ' ]);
33
- }
34
-
35
- if (isset ($ additionalValues ['putFields ' ])) {
36
- $ putFields = array_merge ($ putFields , $ additionalValues ['putFields ' ]);
37
- }
23
+ $ postFields = array_merge ($ postFields , $ additionalValues ['postFields ' ] ?? []);
24
+ $ getFields = array_merge ($ getFields , $ additionalValues ['getFields ' ] ?? []);
25
+ $ cookieFields = array_merge ($ cookieFields , $ additionalValues ['cookieFields ' ] ?? []);
26
+ $ putFields = array_merge ($ putFields , $ additionalValues ['putFields ' ] ?? []);
38
27
39
28
$ postFields = $ this ->normalizeValues ($ postFields );
40
29
$ getFields = $ this ->normalizeValues ($ getFields );
@@ -68,18 +57,12 @@ public function makeRequest(string $url, string $method, array $values, array $a
68
57
curl_setopt ($ curl , CURLOPT_VERBOSE , false );
69
58
curl_setopt ($ curl , CURLOPT_TIMEOUT , 10 );
70
59
curl_setopt ($ curl , CURLOPT_HEADER , true );
71
- if (count ($ postFields )) {
72
- curl_setopt ($ curl , CURLOPT_POST , true );
73
- curl_setopt ($ curl , CURLOPT_POSTFIELDS , $ postFields );
74
- }
75
- if ($ rawPost ) {
76
- curl_setopt ($ curl , CURLOPT_POST , true );
77
- curl_setopt ($ curl , CURLOPT_POSTFIELDS , $ rawPost );
78
- }
79
- if ($ putRawPost ) {
60
+
61
+ if (count ($ postFields ) || $ rawPost || $ putRawPost !== null ) {
80
62
curl_setopt ($ curl , CURLOPT_POST , true );
81
- curl_setopt ($ curl , CURLOPT_POSTFIELDS , $ putRawPost );
63
+ curl_setopt ($ curl , CURLOPT_POSTFIELDS , count ( $ postFields ) ? $ postFields : ( $ rawPost ?: $ putRawPost) );
82
64
}
65
+
83
66
if (count ($ cookieFields )) {
84
67
$ parts = [];
85
68
foreach ($ cookieFields as $ key => $ value ) {
0 commit comments