Skip to content

Commit 16d6b9d

Browse files
committed
fix put calls + remove unused patch
1 parent df9ddc3 commit 16d6b9d

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

lib/Gitlab/Api/AbstractApi.php

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -121,23 +121,6 @@ protected function post($path, array $parameters = array(), $requestHeaders = ar
121121
return ResponseMediator::getContent($response);
122122
}
123123

124-
/**
125-
* @param string $path
126-
* @param array $parameters
127-
* @param array $requestHeaders
128-
* @return mixed
129-
*/
130-
protected function patch($path, array $parameters = array(), $requestHeaders = array())
131-
{
132-
$path = $this->preparePath($path);
133-
134-
$body = empty($parameters) ? null : $this->streamFactory->createStream(http_build_query($parameters));
135-
136-
$response = $this->client->getHttpClient()->patch($path, $requestHeaders, $body);
137-
138-
return ResponseMediator::getContent($response);
139-
}
140-
141124
/**
142125
* @param string $path
143126
* @param array $parameters
@@ -148,7 +131,11 @@ protected function put($path, array $parameters = array(), $requestHeaders = arr
148131
{
149132
$path = $this->preparePath($path);
150133

151-
$body = empty($parameters) ? null : $this->streamFactory->createStream(http_build_query($parameters));
134+
$body = null;
135+
if (!empty($parameters)) {
136+
$body = $this->streamFactory->createStream(http_build_query($parameters));
137+
$requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded';
138+
}
152139

153140
$response = $this->client->getHttpClient()->put($path, $requestHeaders, $body);
154141

0 commit comments

Comments
 (0)