Laravel request stripping tags

Viewed 226

I sending a payload which contains html (from a wysiwyg field) via axios to a Laravel 8 backend.
I can see the data being sent in the payload;

_method: post
message: gvdf<b>gdfs</b>gdfs<div>gf<i>dgdfg</i>dfsg</div><h4>gfdgdfsgdf</h4>

When I dump in the controller the tags are missing from the request (Illuminate\Http\Request) object.
I can see them in the $_POST superglobal, but not the request object (using input and get).

dd($_POST['message'], $request->input('message'), $request->get('message'));

Output

"gvdf<b>gdfs</b>gdfs<div>gf<i>dgdfg</i>dfsg</div><h4>gfdgdfsgdf</h4>"
"gvdfgdfsgdfsgfdgdfgdfsggfdgdfsgdf"
"gvdfgdfsgdfsgfdgdfgdfsggfdgdfsgdf"

Any ideas?

1 Answers

As noted by @N69S there was a middleware in the web middleware group that was stripping tags.
As the offending middleware was only not wanted on that one route, it can be removed using

Route::post('my-post', 'PostController@login')->withoutMiddleware(['sanitize_input']);
Related