Skip to content

Commit

Permalink
multipart need to upload images
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry K committed Jun 28, 2018
1 parent 3d87931 commit cd5ef00
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Client/YouTrackClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,20 @@ protected function buildOptions(array $params = [], $options = []): array
'headers' => $this->buildHeaders(),
];

if (isset($options['form_params'])) {
if (!isset($options['multipart']) && isset($options['form_params'])) {
$options['form_params'] = array_merge($params, $options['form_params']);
}

if (isset($options['multipart'])) {
unset($defaultOptions['form_params']);
foreach ($params as $key => $value) {
$options['multipart'][] = ['name' => $key, 'data' => $value];
}
}

if (isset($options['headers'])) {
$options['headers'] = array_merge($this->buildHeaders(), $options['headers']);
}

return array_merge($defaultOptions, $options);
}

Expand Down

0 comments on commit cd5ef00

Please sign in to comment.