File tree 1 file changed +3
-30
lines changed
1 file changed +3
-30
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ protected function get(string $path, array $parameters = [])
102
102
$ path .= '? ' .http_build_query ($ parameters );
103
103
}
104
104
105
- $ response = $ this ->connection ->getHttpClient ()->get ($ this -> getUri ( $ path) );
105
+ $ response = $ this ->connection ->getHttpClient ()->get ($ path );
106
106
107
107
return json_decode ($ response ->getBody ()->getContents (), true );
108
108
}
@@ -118,37 +118,10 @@ protected function get(string $path, array $parameters = [])
118
118
protected function post (string $ path , array $ parameters = [])
119
119
{
120
120
$ response = $ this ->connection ->getHttpClient ()->post (
121
- $ this ->getUri ($ path ),
122
- [],
123
- $ this ->createJsonBody ($ parameters )
121
+ $ path ,
122
+ ['json ' => $ parameters ]
124
123
);
125
124
126
125
return json_decode ($ response ->getBody ()->getContents (), true );
127
126
}
128
-
129
- /**
130
- * Get the URI used for the request.
131
- *
132
- * @param string $path
133
- *
134
- * @return string
135
- */
136
- private function getUri (string $ path ): string
137
- {
138
- return '/ ' !== $ path [0 ] ? "/ {$ path }" : $ path ;
139
- }
140
-
141
- /**
142
- * Create a JSON encoded version of an array of parameters.
143
- *
144
- * @param array $parameters Request parameters
145
- *
146
- * @return null|string
147
- */
148
- protected function createJsonBody (array $ parameters ): ?string
149
- {
150
- return (count ($ parameters ) === 0 )
151
- ? null
152
- : json_encode ($ parameters , empty ($ parameters ) ? JSON_FORCE_OBJECT : 0 );
153
- }
154
127
}
You can’t perform that action at this time.
0 commit comments