File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,25 @@ public function __construct(SparkPost $sparkpost)
14
14
*
15
15
* @return SparkPostPromise or SparkPostResponse depending on sync or async request
16
16
*/
17
- public function post ($ payload , $ headers = [])
17
+ public function post ($ payload = [] , $ headers = [])
18
18
{
19
+ $ payload = $ this ->formatPayload ($ payload );
20
+ return parent ::post ($ payload , $ headers );
21
+ }
22
+
23
+ /**
24
+ * Runs the given payload through the formatting methods
25
+ *
26
+ * @param array $payload - the request body
27
+ *
28
+ * @return array - the modified request body
29
+ */
30
+ public function formatPayload ($ payload ) {
19
31
$ payload = $ this ->formatBlindCarbonCopy ($ payload ); //Fixes BCCs into payload
20
32
$ payload = $ this ->formatCarbonCopy ($ payload ); //Fixes CCs into payload
21
33
$ payload = $ this ->formatShorthandRecipients ($ payload ); //Fixes shorthand recipients format
22
- return parent ::post ($ payload , $ headers );
34
+
35
+ return $ payload ;
23
36
}
24
37
25
38
/**
You can’t perform that action at this time.
0 commit comments