Skip to content

Commit e8d932d

Browse files
eiriksmavigoldman
authored andcommitted
Remove form feeds (Fix #141).
1 parent 34dcd9b commit e8d932d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/SparkPost/SparkPost.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,13 @@ public function buildRequest($method, $uri, $payload, $headers)
147147
$url = $this->getUrl($uri, $params);
148148
$headers = $this->getHttpHeaders($headers);
149149

150-
return $this->getMessageFactory()->createRequest($method, $url, $headers, json_encode($body));
150+
// Sparkpost API will not tolerate form feed in JSON.
151+
$jsonReplace = [
152+
'\f' => '',
153+
];
154+
$body = strtr(json_encode($body), $jsonReplace);
155+
156+
return $this->getMessageFactory()->createRequest($method, $url, $headers, $body);
151157
}
152158

153159
/**

0 commit comments

Comments
 (0)