Commit 2419e2ccf6c1eaa66c15dfae852f21bdb508057c

Authored by Elena Budnik
1 parent 5b396c42

cors header for data

src/DDSERVICES/HAPI/capabilities.php
... ... @@ -7,7 +7,7 @@
7 7  
8 8 header('Content-Type: application/json');
9 9 header("Access-Control-Allow-Origin: *");
10   - header("Access-Control-Allow-Methods: GET"); //'Access-Control-Allow-{Origin,Methods} = {*, GET}');
  10 + header("Access-Control-Allow-Methods: GET");
11 11  
12 12 exit(json_encode($response));
13 13 ?>
... ...
src/DDSERVICES/HAPI/catalog.php
... ... @@ -15,7 +15,7 @@
15 15  
16 16 header('Content-Type: application/json');
17 17 header("Access-Control-Allow-Origin: *");
18   - header("Access-Control-Allow-Methods: GET"); //'Access-Control-Allow-{Origin,Methods} = {*, GET}');
  18 + header("Access-Control-Allow-Methods: GET");
19 19  
20 20 exit(json_encode($response));
21 21 ?>
... ...
src/DDSERVICES/HAPI/data.php
... ... @@ -37,8 +37,9 @@
37 37 $response["HAPI"] = "2.0";
38 38  
39 39 if (!$_GET["id"]) {
40   - $response["status"] = 400;
41   - $response["msg"] = "No ID !!!";
  40 + header("HTTP/1.1 404 NO SUCH ID");
  41 + $response["status"] = 1406;
  42 + $response["msg"] = "NO SUCH ID !!!";
42 43  
43 44 header('Content-Type: application/json');
44 45  
... ... @@ -68,6 +69,8 @@
68 69 }
69 70  
70 71 disable_ob();
  72 + header("Access-Control-Allow-Origin: *");
  73 + header("Access-Control-Allow-Methods: GET");
71 74 $handle = popen($cmd, 'r');
72 75 while(!feof($handle)) {
73 76 $buffer = fgets($handle);
... ...