Skip to content

Commit

Permalink
fix for #789
Browse files Browse the repository at this point in the history
  • Loading branch information
mevdschee committed May 8, 2021
1 parent 2eefad8 commit 3c4b24f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api.include.php
Expand Up @@ -11365,7 +11365,7 @@ public function __construct(Config $config)

private function parseBody(string $body) /*: ?object*/
{
$first = substr($body, 0, 1);
$first = substr(ltrim($body), 0, 1);
if ($first == '[' || $first == '{') {
$object = json_decode($body);
$causeCode = json_last_error();
Expand Down
2 changes: 1 addition & 1 deletion api.php
Expand Up @@ -11365,7 +11365,7 @@ public function __construct(Config $config)

private function parseBody(string $body) /*: ?object*/
{
$first = substr($body, 0, 1);
$first = substr(ltrim($body), 0, 1);
if ($first == '[' || $first == '{') {
$object = json_decode($body);
$causeCode = json_last_error();
Expand Down
2 changes: 1 addition & 1 deletion src/Tqdev/PhpCrudApi/Api.php
Expand Up @@ -169,7 +169,7 @@ public function __construct(Config $config)

private function parseBody(string $body) /*: ?object*/
{
$first = substr($body, 0, 1);
$first = substr(ltrim($body), 0, 1);
if ($first == '[' || $first == '{') {
$object = json_decode($body);
$causeCode = json_last_error();
Expand Down
22 changes: 22 additions & 0 deletions tests/functional/001_records/007_edit_post.log
Expand Up @@ -16,3 +16,25 @@ Content-Type: application/json; charset=utf-8
Content-Length: 62

{"id":3,"user_id":1,"category_id":1,"content":"test (edited)"}
===
PUT /records/posts/3

{
"user_id": 1,
"category_id": 1,
"content": "test (edited 1)"
}
===
200
Content-Type: application/json; charset=utf-8
Content-Length: 1

1
===
GET /records/posts/3
===
200
Content-Type: application/json; charset=utf-8
Content-Length: 64

{"id":3,"user_id":1,"category_id":1,"content":"test (edited 1)"}

0 comments on commit 3c4b24f

Please sign in to comment.