mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Also recognize Content-Type headers with optional parameters
This commit is contained in:
parent
d731198aa6
commit
cf84d70ca1
1 changed files with 2 additions and 4 deletions
|
|
@ -129,18 +129,16 @@ class HTTP
|
|||
}
|
||||
elseif (is_array($data) && count($data) > 0)
|
||||
{
|
||||
if (isset($headers['Content-Type']) && $headers['Content-Type'] === 'multipart/form-data')
|
||||
if (isset($headers['Content-Type']) && preg_match('!^multipart/form-data\b!i', $headers['Content-Type']))
|
||||
{
|
||||
unset($headers['Content-Type']);
|
||||
$settings['multipart'] = [];
|
||||
foreach ($data as $key => $val)
|
||||
{
|
||||
$settings['multipart'][] = ['name' => $key, 'contents' => $val];
|
||||
}
|
||||
}
|
||||
elseif (isset($headers['Content-Type']) && $headers['Content-Type'] === 'application/json')
|
||||
elseif (isset($headers['Content-Type']) && preg_match('!^application/json\b!i', $headers['Content-Type']))
|
||||
{
|
||||
unset($headers['Content-Type']);
|
||||
$settings['json'] = $data;
|
||||
}
|
||||
elseif ($method !== 'GET')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue