@@ -133,8 +133,9 @@ public function getResponses()
133133 public function getRequests ()
134134 {
135135 return [
136- [$ this ->getServerRequest ('https://ohyt2ctr9l0z.runscope.net/sms_post ' , 'POST ' , 'inbound ' )],
137- [$ this ->getServerRequest ('https://ohyt2ctr9l0z.runscope.net/sms_post ' , 'GET ' , 'inbound ' )],
136+ 'post, application/json ' => [$ this ->getServerRequest ('https://ohyt2ctr9l0z.runscope.net/sms_post ' , 'POST ' , 'json ' , ['Content-Type ' => 'application/json ' ])],
137+ 'post, form-encoded ' => [$ this ->getServerRequest ('https://ohyt2ctr9l0z.runscope.net/sms_post ' , 'POST ' , 'inbound ' )],
138+ 'get, form-encoded ' => [$ this ->getServerRequest ('https://ohyt2ctr9l0z.runscope.net/sms_post ' , 'GET ' , 'inbound ' )],
138139 ];
139140 }
140141
@@ -144,7 +145,7 @@ public function getRequests()
144145 * @param null $file
145146 * @return ServerRequest
146147 */
147- protected function getServerRequest ($ url = 'https://ohyt2ctr9l0z.runscope.net/sms_post ' , $ method = 'GET ' , $ type = 'inbound ' )
148+ protected function getServerRequest ($ url = 'https://ohyt2ctr9l0z.runscope.net/sms_post ' , $ method = 'GET ' , $ type = 'inbound ' , $ headers = [] )
148149 {
149150 $ data = file_get_contents (__DIR__ . '/requests/ ' . $ type . '.txt ' );
150151 $ params = [];
@@ -162,10 +163,14 @@ protected function getServerRequest($url = 'https://ohyt2ctr9l0z.runscope.net/sm
162163 $ body = fopen (__DIR__ . '/requests/ ' . $ type . '.txt ' , 'r ' );
163164 $ query = [];
164165 $ parsed = $ params ;
166+ if (isset ($ headers ['Content-Type ' ]) && $ headers ['Content-Type ' ] === 'application/json ' )
167+ {
168+ $ parsed = null ;
169+ }
165170 break ;
166171 }
167172
168- return new ServerRequest ([], [], $ url , $ method , $ body , [] , [], $ query , $ parsed );
173+ return new ServerRequest ([], [], $ url , $ method , $ body , $ headers , [], $ query , $ parsed );
169174 }
170175
171176 /**
0 commit comments