Answer the question
In order to leave comments, you need to log in
Why do all my requests fail with the CORS policy if the response code is not 200?
There is a method that I pull from the front:
public function callAccountAction() {
sleep(1);
http_response_code(403);
// $this->sendResponse('error', ['error_code' => 1001, 'error_message' => 'Invalid request. Error code: 1001']);
$data = $this->getStreamInput();
$status = $this->ckeckSignature($_SERVER['HTTP_AUTHORIZATION']);
if (!$status) {
http_response_code(403);
}
if (empty($data->user->id)) {
http_response_code(400);
}
if (!$this->model->isUserExists($data->user->id)) {
$this->model->addUser($data->user);
$this->sendResponse('success', ['status' => true, 'isInitial' => true]);
}
$this->sendResponse('success', ['status' => true]);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question