mirror of
https://github.com/getnamingo/registry.git
synced 2025-08-11 20:09:28 +02:00
Added two missing headers
This commit is contained in:
parent
d06b842702
commit
e378970764
1 changed files with 2 additions and 0 deletions
|
@ -48,6 +48,7 @@ $http->on('request', function ($request, $response) {
|
||||||
$pdo = new PDO('mysql:host=localhost;dbname=registry', 'registry-select', 'EPPRegistrySELECT');
|
$pdo = new PDO('mysql:host=localhost;dbname=registry', 'registry-select', 'EPPRegistrySELECT');
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
|
$response->header('Content-Type', 'application/json');
|
||||||
$response->end(json_encode(['error' => 'Error connecting to database']));
|
$response->end(json_encode(['error' => 'Error connecting to database']));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -80,6 +81,7 @@ $http->on('request', function ($request, $response) {
|
||||||
handleSearchQuery($request, $response, $pdo, $searchPattern);
|
handleSearchQuery($request, $response, $pdo, $searchPattern);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
$response->header('Content-Type', 'application/json');
|
||||||
$response->status(404);
|
$response->status(404);
|
||||||
$response->end(json_encode(['error' => 'Endpoint not found']));
|
$response->end(json_encode(['error' => 'Endpoint not found']));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue