L
L
lexstile2021-08-29 14:42:53
PHP
lexstile, 2021-08-29 14:42:53

What should be returned when calling the service with the OPTIONS method?

I read articles that you need to return methods supported by the service.
The method will work on a POST request.
By default, I plan to return that the method is not supported.
But what and in what form to return with the OPTIONS method?

switch ($_SERVER['REQUEST_METHOD']) {
      case 'OPTIONS': break;
      case 'POST': break;
      default: break;
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Volodymyr Palamar, 2021-08-29
@lexstile

You can return anything.
You can even come up with your own method and also return something.
But the browser uses it to check cors headers , and it is advisable not to send anything else except for them

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question