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 @@ public function buildRequest($method, $uri, $payload, $headers) $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); } /**