Skip to content

Commit

Permalink
#35 delete API le type "text/plain"
Browse files Browse the repository at this point in the history
  • Loading branch information
bfoujols committed Oct 6, 2023
1 parent 6849a4c commit 77e150e
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions src/EduFramework/Core/Controller/FastRouteCore.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,26 +117,6 @@ public function getRoute(): string|null
// Exemple: [0] => 1 [1] => App\Controller\HomeController [2] => Array ( [id] => 1 )
$routeInfo = $dispatcher->dispatch($httpMethod, $uri);

// Pour récupérer des données de type text/plain
if ($_SERVER['REQUEST_METHOD'] === 'POST'
&& isset($_SERVER['CONTENT_TYPE'])
&& $_SERVER['CONTENT_TYPE'] === 'text/plain') {
// Lire les données brutes de la requête
$routeInfo[2] = array_merge(
$routeInfo[2],
json_decode(
str_replace(
"data=",
"",
file_get_contents('php://input')
),
true,
512,
JSON_THROW_ON_ERROR
)
);
}

switch ($routeInfo[0]) {
// Si la route n'est pas trouvée alors j'affiche la page 404
case Dispatcher::NOT_FOUND:
Expand Down

0 comments on commit 77e150e

Please sign in to comment.