Answer the question
In order to leave comments, you need to log in
Why is there a redirect in Yii2 when creating an entity via REST?
The action for rest to create an entity has the following code:
namespace yii\rest;
...
class CreateAction extends Action
{
...
public function run()
{
...
if ($model->save()) {
...
$response->getHeaders()->set('Location', Url::toRoute([$this->viewAction, 'id' => $id], true));
} elseif (!$model->hasErrors()) {
...
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