Add quotes around the boundary. (#278)

This will support bounderies with non whitespace
This commit is contained in:
Tobias Nyholm 2017-02-18 18:14:12 +01:00 committed by GitHub
parent e177e13a0c
commit 47f816ac56
2 changed files with 2 additions and 2 deletions

View File

@ -96,7 +96,7 @@ class RestClient
$builder->addResource($file['name'], $file['contents'], $file); $builder->addResource($file['name'], $file['contents'], $file);
} }
$body = $builder->build(); $body = $builder->build();
$headers['Content-Type'] = 'multipart/form-data; boundary='.$builder->getBoundary(); $headers['Content-Type'] = 'multipart/form-data; boundary="'.$builder->getBoundary().'"';
} elseif (is_array($body)) { } elseif (is_array($body)) {
$body = http_build_query($body); $body = http_build_query($body);
$headers['Content-Type'] = 'application/x-www-form-urlencoded'; $headers['Content-Type'] = 'application/x-www-form-urlencoded';

View File

@ -65,7 +65,7 @@ class RequestBuilder
$multipartStream = $builder->build(); $multipartStream = $builder->build();
$boundary = $builder->getBoundary(); $boundary = $builder->getBoundary();
$headers['Content-Type'] = 'multipart/form-data; boundary='.$boundary; $headers['Content-Type'] = 'multipart/form-data; boundary="'.$boundary.'"';
return $this->getRequestFactory()->createRequest($method, $uri, $headers, $multipartStream); return $this->getRequestFactory()->createRequest($method, $uri, $headers, $multipartStream);
} }