-1

I have a really strange "bug" happening right now. I have a small API where I want to handle different methods, but when sending a POST request the server handles it as GET method. Here's my code:

<?php
  $C_Metodo = $_SERVER["REQUEST_METHOD"];
  $N_Estado = 200;
  $O_Estado = ["status" => $C_Metodo];

  http_response_code($N_Estado);
  echo json_encode($O_Estado);
?>

When sending a DELETE or another method the response is the right method, but when using POST it returns GET.

Postman sending POST request: Postman sending POST request

Barmar
  • 741,623
  • 53
  • 500
  • 612

1 Answers1

0

I have checked and POSTMAN working fine and provide POST method in response.`

$C_Metodo = $_SERVER["REQUEST_METHOD"];

$N_Estado = 200;

$O_Estado = $C_Metodo;

var_dump($C_Metodo); ?>`

check with this script.

Foramkumar Patel
  • 299
  • 3
  • 10