@@ -213,7 +213,6 @@ public function handleRequest(ServerRequestInterface $request)
213213 return $ this ->handleInteraction ($ interaction )->then (function ($ result ) {
214214 $ this ->logger ->info ('responding to interaction ' , $ result );
215215
216- header ('Content-Type: application/json ' );
217216 return new Response (Response::STATUS_OK , ['Content-Type ' => 'application/json ' ], json_encode ($ result ));
218217 });
219218 }
@@ -251,23 +250,17 @@ private function handleApplicationCommand(Interaction $interaction): void
251250 $ checkCommand = function ($ command ) use ($ interaction , &$ checkCommand ) {
252251 if (isset ($ this ->commands [$ command ['name ' ]])) {
253252 if ($ this ->commands [$ command ['name ' ]]->execute ($ command ['options ' ] ?? [], $ interaction )) {
254- $ this ->logger ->info ('executing command ' , $ command );
255253 return true ;
256254 }
257255 }
258256
259257 foreach ($ command ['options ' ] ?? [] as $ option ) {
260258 if ($ checkCommand ($ option )) {
261- $ this ->logger ->info ('executing option ' , $ command );
262259 return true ;
263260 }
264261 }
265-
266- $ this ->logger ->info ('done finding command ' , $ command );
267262 };
268263
269- $ this ->logger ->info ('finding command ' , $ interaction ->data );
270-
271264 $ checkCommand ($ interaction ->data );
272265 }
273266
@@ -320,6 +313,7 @@ public function runCgi()
320313 $ serverRequest = (new \Kambo \Http \Message \Factories \Environment \ServerRequestFactory ())->create ($ environment );
321314
322315 $ this ->handleRequest ($ serverRequest )->then (function (Response $ response ) {
316+ header ('Content-Type: application/json ' ); // Workaround
323317 http_response_code ($ response ->getStatusCode ());
324318 echo (string ) $ response ->getBody ();
325319 });
0 commit comments