Can you post here your code?
Jan 31, 2020
4
Level 1
Request getContent differs in live and tests
Hey guys,
The class \Illuminate\Foundation\Testing\Concerns\MakesHttpRequests is used by Laravel in test cases so you can test and endpoint (like $this->post) the bug I am facing is that if I call $request->getContent(); in my controller it will return empty string. This only happens in test environments. Normal behaviour of Laravel requests is that getContent will return the raw body of the request.
So to sum up: Request::getContent returns empty string in test environment, but raw body of request in live environment.
Does anybody know how to get the raw body of a request in test environment?
Please or to participate in this conversation.