From 47f816ac5641daffc13fb1ed044a4cc14ed50dda Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Sat, 18 Feb 2017 18:14:12 +0100 Subject: [PATCH] Add quotes around the boundary. (#278) This will support bounderies with non whitespace --- src/Mailgun/Connection/RestClient.php | 2 +- src/Mailgun/RequestBuilder.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mailgun/Connection/RestClient.php b/src/Mailgun/Connection/RestClient.php index 63f160b..1c18d12 100644 --- a/src/Mailgun/Connection/RestClient.php +++ b/src/Mailgun/Connection/RestClient.php @@ -96,7 +96,7 @@ class RestClient $builder->addResource($file['name'], $file['contents'], $file); } $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)) { $body = http_build_query($body); $headers['Content-Type'] = 'application/x-www-form-urlencoded'; diff --git a/src/Mailgun/RequestBuilder.php b/src/Mailgun/RequestBuilder.php index f5d5cf9..6df9a12 100644 --- a/src/Mailgun/RequestBuilder.php +++ b/src/Mailgun/RequestBuilder.php @@ -65,7 +65,7 @@ class RequestBuilder $multipartStream = $builder->build(); $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); }