Download & Extend

Accepting POST request only does not work

Project:JSON server
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

Hi..

I'm currently doing simpletest cases for the services modules. I realized that json_server need some love also, so I've started to write a testcase for it.

After a DrupalGet request, The following assert is not working:

<?php
  $this
->assertEqual($response['#data'], 'JSON server accepts POST requests only.', 'JSON server accepts POST requests only.');
?>

Doing a isset($_POST) does not work, and $_SERVER['REQUEST_METHOD'] should be used, after that change the test does not fail.

The patch includes the simpletest file.

Note: due to json_decode creating an stdClass with the content, I would suggest removing the '#' character in #error and #data responses. There's no way to get the $content->#error element after doing json_decode on return from server, and should be casted as array.

Comments

#1

Status:active» needs review
AttachmentSize
610364_json_server_post_only.patch 2.63 KB

#2

Version:6.x-1.x-dev» 6.x-2.x-dev

+1