# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: contributions/modules/json_server/json_server.module
--- contributions/modules/json_server/json_server.module Base (1.6)
+++ contributions/modules/json_server/json_server.module Locally Modified (Based On 1.6)
@@ -13,7 +13,7 @@
 }
 
 function json_server_server() {
-  if (!isset($_POST)) {
\ No newline at end of file
+  if ($_SERVER['REQUEST_METHOD'] != 'POST') {
\ No newline at end of file
     return drupal_to_js(array('#error' => TRUE, '#data' => "JSON server accepts POST requests only."));
   }
   
Index: contributions/modules/json_server/tests/json_server.test
--- contributions/modules/json_server/tests/json_server.test No Base Revision
+++ contributions/modules/json_server/tests/json_server.test Locally New
@@ -0,0 +1,47 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Set of simpletests for the JOSN server implmenetation.
+ *
+ * Tests were written according to module and services functionality.
+ *
+ */
+class JsonServerTestCase extends DrupalWebTestCase {
+
+  public static function getInfo() {
+    return array(
+      'name' => t('Json server'),
+      'description' => t('Test case for implementation of JSON server module.'),
+      'group' => t('Services'),
+    );
+  }
+
+  function setUp() {
+    //Default initialization, enable modules
+    parent::setUp('services', 'services_keyauth', 'system_service', 'user_service', 'json_server');
+  }
+
+  /**
+   * Some validations on the json server interface
+   */
+  function testJsonServerDefaultService(){
+    $result = $this->DrupalGet('services/json');
+
+    //JSON server interface should available for anonymous users
+    $this->assertResponse(200, 'Json server is available for anonymous user');
+
+    //Check service default response. Need to convert to array, because
+    //json_decode returns object, and there is no way to get $object->#error
+    //or $object->#data attributes
+    $response = (array)json_decode($result);
+    //$this->pass(print_r($response ,1));
+
+    //The json server currently supports POST requests only.
+    $this->assertNotEqual($response, $result, 'Returned content is json content');
+    $this->assertTrue($response['#error'], 'Error has been detected using a GET request');
+    $this->assertEqual($response['#data'], 'JSON server accepts POST requests only.', 'JSON server accepts POST requests only.');
+  }
+
+}
\ No newline at end of file
