Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not post application/json #11

Open
NaokiTsuchiya opened this issue Apr 2, 2021 · 0 comments
Open

Can not post application/json #11

NaokiTsuchiya opened this issue Apr 2, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@NaokiTsuchiya
Copy link

NaokiTsuchiya commented Apr 2, 2021

Bug Report

repo https://github.com/NaokiTsuchiya/BEAR.Swoole/tree/Fix-post-json

run swoole server

$ php tests/bin/swoole.php
Swoole http server is started at http://127.0.0.1:8088

send POST request

curl -v -XPOST -d "{}" -H "Content-Type: application/json" 127.0.0.1:8088

Swoole server's log

Swoole http server is started at http://127.0.0.1:8088
PHP Fatal error:  Uncaught BEAR\Package\Exception\InvalidRequestJsonException: Syntax error in /Users/tsuchiya/work/tsuchiya/BEAR.Swoole/vendor/bear/package/src/Provide/Router/HttpMethodParams.php:157
Stack trace:
#0 /Users/tsuchiya/work/tsuchiya/BEAR.Swoole/vendor/bear/package/src/Provide/Router/HttpMethodParams.php(124): BEAR\Package\Provide\Router\HttpMethodParams->phpInput(Array)
#1 /Users/tsuchiya/work/tsuchiya/BEAR.Swoole/vendor/bear/package/src/Provide/Router/HttpMethodParams.php(73): BEAR\Package\Provide\Router\HttpMethodParams->getParams('post', Array, Array)
#2 /Users/tsuchiya/work/tsuchiya/BEAR.Swoole/vendor/bear/package/src/Provide/Router/HttpMethodParams.php(61): BEAR\Package\Provide\Router\HttpMethodParams->unsafeMethod('post', Array, Array)
#3 /Users/tsuchiya/work/tsuchiya/BEAR.Swoole/vendor/bear/package/src/Provide/Router/WebRouter.php(47): BEAR\Package\Provide\Router\HttpMethodParams->get(Array, Array, Array)
#4 /Users/tsuchiya/work/tsuchiya/BEAR.Swoole/bootstrap.php(43): BEAR\Package\Provide\Router\WebRouter->match(Array, Array)
#5 {main}
  thrown in /Users/tsuchiya/work/tsuchiya/BEAR.Swoole/vendor/bear/package/src/Provide/Router/HttpMethodParams.php on line 157

Fatal error: Uncaught BEAR\Package\Exception\InvalidRequestJsonException: Syntax error in /Users/tsuchiya/work/tsuchiya/BEAR.Swoole/vendor/bear/package/src/Provide/Router/HttpMethodParams.php:157
Stack trace:
#0 /Users/tsuchiya/work/tsuchiya/BEAR.Swoole/vendor/bear/package/src/Provide/Router/HttpMethodParams.php(124): BEAR\Package\Provide\Router\HttpMethodParams->phpInput(Array)
#1 /Users/tsuchiya/work/tsuchiya/BEAR.Swoole/vendor/bear/package/src/Provide/Router/HttpMethodParams.php(73): BEAR\Package\Provide\Router\HttpMethodParams->getParams('post', Array, Array)
#2 /Users/tsuchiya/work/tsuchiya/BEAR.Swoole/vendor/bear/package/src/Provide/Router/HttpMethodParams.php(61): BEAR\Package\Provide\Router\HttpMethodParams->unsafeMethod('post', Array, Array)
#3 /Users/tsuchiya/work/tsuchiya/BEAR.Swoole/vendor/bear/package/src/Provide/Router/WebRouter.php(47): BEAR\Package\Provide\Router\HttpMethodParams->get(Array, Array, Array)
#4 /Users/tsuchiya/work/tsuchiya/BEAR.Swoole/bootstrap.php(43): BEAR\Package\Provide\Router\WebRouter->match(Array, Array)
#5 {main}
  thrown in /Users/tsuchiya/work/tsuchiya/BEAR.Swoole/vendor/bear/package/src/Provide/Router/HttpMethodParams.php on line 157

Here is a red test.

NaokiTsuchiya@27964b1

@koriym koriym added the bug Something isn't working label Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants