We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent da833c0 commit 7f3cbd5Copy full SHA for 7f3cbd5
src/Endpoint/Create.php
@@ -76,9 +76,15 @@ public function handle(Context $context): ?ResponseInterface
76
$callback($model, $context);
77
}
78
79
- return json_api_response($document = $this->showResource($context, $model))
80
- ->withStatus(201)
81
- ->withHeader('Location', $document['data']['links']['self']);
+ $response = json_api_response(
+ $document = $this->showResource($context, $model),
+ )->withStatus(201);
82
+
83
+ if ($location = $document['data']['links']['self'] ?? null) {
84
+ $response = $response->withHeader('Location', $location);
85
+ }
86
87
+ return $response;
88
89
90
public function after(callable $callback): static
0 commit comments