diff options
author | eiriksm <eirik@morland.no> | 2016-08-24 17:20:14 +0200 |
---|---|---|
committer | Avi Goldman <avrahamymgoldman@gmail.com> | 2016-08-24 11:20:14 -0400 |
commit | e8d932d05c59c3f4f48124bfed0de7187d56751f (patch) | |
tree | a020acd6959a6583484d9ea807b0010bd05a70d9 | |
parent | 34dcd9b35098ffb7565c4e6a51c84c2c38a07a0f (diff) | |
download | php-sparkpost-e8d932d05c59c3f4f48124bfed0de7187d56751f.zip php-sparkpost-e8d932d05c59c3f4f48124bfed0de7187d56751f.tar.gz php-sparkpost-e8d932d05c59c3f4f48124bfed0de7187d56751f.tar.bz2 |
Remove form feeds (Fix #141).
-rw-r--r-- | lib/SparkPost/SparkPost.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/SparkPost/SparkPost.php b/lib/SparkPost/SparkPost.php index d4e9421..0d3c6b5 100644 --- a/lib/SparkPost/SparkPost.php +++ b/lib/SparkPost/SparkPost.php @@ -147,7 +147,13 @@ class SparkPost $url = $this->getUrl($uri, $params); $headers = $this->getHttpHeaders($headers); - return $this->getMessageFactory()->createRequest($method, $url, $headers, json_encode($body)); + // Sparkpost API will not tolerate form feed in JSON. + $jsonReplace = [ + '\f' => '', + ]; + $body = strtr(json_encode($body), $jsonReplace); + + return $this->getMessageFactory()->createRequest($method, $url, $headers, $body); } /** |