не, я в заголовках прописывал специально Content-type: application/json.. Грит, что невалидный json.
Передаю через postman. Там есть возможность заполнить табличку form-data с параметрами..
Два одинаковых запроса отправляю на POST и PUT. POST обрабатывает, PUT нет. При этом и обработчики у них одинаковые =)
текст ошибки (+/-)
{
"error": {
"code": 400,
"message": "Bad Request",
"exception": [
{
"message": "Invalid json message received",
"class": "Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException",
"trace": [
{
"namespace": "",
"short_class": "",
"class": "",
"type": "",
"function": "",
"file": "/home/ujin/PhpstormProjects/university/api/structure/vendor/friendsofsymfony/rest-bundle/EventListener/BodyListener.php",
"line": 115,
"args": []
},
{
"namespace": "FOS\\RestBundle\\EventListener",
"short_class": "BodyListener",
"class": "FOS\\RestBundle\\EventListener\\BodyListener",
"type": "->",
"function": "onKernelRequest",
"file": null,
"line": null,
"args": [
[
"object",
"Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent"
],
[
"string",
"kernel.request"
],
[
"object",
"Symfony\\Component\\HttpKernel\\Debug\\TraceableEventDispatcher"
]
]
},
{
"namespace": "",
"short_class": "",
"class": "",
"type": "",
"function": "call_user_func",
"file": "/home/ujin/PhpstormProjects/university/api/structure/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php",
"line": 104,
"args": [
[
"array",
[
[
"object",
"FOS\\RestBundle\\EventListener\\BodyListener"
],
[
"string",
"onKernelRequest"
]
]
],
[
"object",
"Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent"
],
[
"string",
"kernel.request"
],
[
"object",
"Symfony\\Component\\HttpKernel\\Debug\\TraceableEventDispatcher"
]
]
},
{
"namespace": "Symfony\\Component\\EventDispatcher\\Debug",
"short_class": "WrappedListener",
"class": "Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener",
"type": "->",
"function": "__invoke",
"file": null,
"line": null,
"args": [
[
"object",
"Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent"
],
[
"string",
"kernel.request"
],
[
"object",
"Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher"
]
]
},
{
"namespace": "",
"short_class": "",
"class": "",
"type": "",
"function": "call_user_func",
"file": "/home/ujin/PhpstormProjects/university/api/structure/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php",
"line": 212,
"args": [
[
"object",
"Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"
],
[
"object",
"Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent"
],
[
"string",
"kernel.request"
],
[
"object",
"Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher"
]
]
},
{
"namespace": "Symfony\\Component\\EventDispatcher",
"short_class": "EventDispatcher",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "->",
"function": "doDispatch",
"file": "/home/ujin/PhpstormProjects/university/api/structure/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php",
"line": 44,
"args": [
[
"array",
[
[
"object",
"Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"
],
[
"object",
"Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"
],
[
"object",
"Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"
],
[
"object",
"Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"
],
[
"object",
"Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"
],
[
"object",
"Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"
],
[
"object",
"Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"
],
[
"object",
"Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"
],
[
"object",
"Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"
],
[
"object",
"Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"
],
[
"object",
"Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener"
]
]
],
[
"string",
"kernel.request"
],
[
"object",
"Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent"
]
]
},
{
"namespace": "Symfony\\Component\\EventDispatcher",
"short_class": "EventDispatcher",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "->",
"function": "dispatch",
"file": "/home/ujin/PhpstormProjects/university/api/structure/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php",
"line": 146,
"args": [
[
"string",
"kernel.request"
],
[
"object",
"Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent"
]
]
},
{
"namespace": "Symfony\\Component\\EventDispatcher\\Debug",
"short_class": "TraceableEventDispatcher",
"class": "Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher",
"type": "->",
"function": "dispatch",
"file": "/home/ujin/PhpstormProjects/university/api/structure/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php",
"line": 129,
"args": [
[
"string",
"kernel.request"
],
[
"object",
"Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent"
]
]
},
{
"namespace": "Symfony\\Component\\HttpKernel",
"short_class": "HttpKernel",
"class": "Symfony\\Component\\HttpKernel\\HttpKernel",
"type": "->",
"function": "handleRaw",
"file": "/home/ujin/PhpstormProjects/university/api/structure/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php",
"line": 68,
"args": [
[
"object",
"Symfony\\Component\\HttpFoundation\\Request"
],
[
"integer",
1
]
]
},
{
"namespace": "Symfony\\Component\\HttpKernel",
"short_class": "HttpKernel",
"class": "Symfony\\Component\\HttpKernel\\HttpKernel",
"type": "->",
"function": "handle",
"file": "/home/ujin/PhpstormProjects/university/api/structure/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php",
"line": 171,
"args": [
[
"object",
"Symfony\\Component\\HttpFoundation\\Request"
],
[
"integer",
1
],
[
"boolean",
true
]
]
},
{
"namespace": "Symfony\\Component\\HttpKernel",
"short_class": "Kernel",
"class": "Symfony\\Component\\HttpKernel\\Kernel",
"type": "->",
"function": "handle",
"file": "/home/ujin/PhpstormProjects/university/api/structure/web/app_dev.php",
"line": 29,
"args": [
[
"object",
"Symfony\\Component\\HttpFoundation\\Request"
]
]
},
{
"namespace": "",
"short_class": "",
"class": "",
"type": "",
"function": "require",
"file": "/home/ujin/PhpstormProjects/university/api/structure/vendor/symfony/symfony/src/Symfony/Bundle/WebServerBundle/Resources/router.php",
"line": 42,
"args": [
[
"string",
"/home/ujin/PhpstormProjects/university/api/structure/web/app_dev.php"
]
]
}
]
}
]
}
}