}
public function method_post_accept() {
- if ( !empty($_SERVER['REQUEST_METHOD']) and $_SERVER['REQUEST_METHOD'] == 'POST' ) {
- foreach (['json','yaml'] as $type) {
- if (empty($_POST[$type]) or !strpos(self::client_content_type(),'/'.$type)) continue;
+ if ( empty($_SERVER['REQUEST_METHOD']) or $_SERVER['REQUEST_METHOD'] != 'POST' ) return;
+ #bye($_POST);
+ $raw = null;
+# NB 11.12.17 $keys = array_keys($_POST);
+# NB 11.12.17 if (count($keys) == 1 and empty($_POST[$keys[0]])) {
+# NB 11.12.17 $raw = $keys[0];
+# NB 11.12.17 bye($raw);
+# NB 11.12.17 }
+
+ foreach (['json','yaml'] as $type) {
+
+ if (!strpos(self::client_content_type(),'/'.$type)) continue;
+ if ($raw) $_POST = [ $type => $raw ];
+ if (empty($_POST[$type])) continue;
+ #bye($_POST);
+ $post = $_POST;
- $post = $_POST;
- unset($post[$type]);
+ unset($post[$type]);
- $fct = $type . '_decode';
- $_POST = array_merge((array)$this->$fct($_POST[$type]),$post);
+ $fct = $type . '_decode';
+ $_POST = array_merge((array)$this->$fct($_POST[$type]),$post);
- break;
- }
- #bye($_POST);
+ break;
}
+
+ #bye($_POST);
}
public function parse_uri() {