Skip to content

Commit

Permalink
Merge pull request #40 from dmkdev/master
Browse files Browse the repository at this point in the history
Allow multipart requests
  • Loading branch information
Anton Komarev authored Jun 30, 2018
2 parents 3d87931 + cd5ef00 commit 82dba4f
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 82dba4f

Please sign in to comment.