laracraft-tech / laravel-xhprof

Easy XHProf setup to profile your Laravel application!
MIT License
219 stars 11 forks source link

fix(middleware): Prevent include on json requests #13

Closed gaetan-hexadog closed 1 year ago

gaetan-hexadog commented 1 year ago

This PR to only include if request does not expect JSON.

I'm not using $request->excpectsJson or $rquest->wantsJson to work with Livewire (because Livewire only set content-type header to json.)

Sairahcaz commented 1 year ago

HI @gaetan-hexadog thanks for your PR. But I can't merge it like this, cause it would make ajax request not to be profiled anymore...

gaetan-hexadog commented 1 year ago

Fair enough. How can we keep ajax requests being profiled without adding the html link at the end of the response then?

Do you think setting $_xhprof['display'] = false when request starts with livewire will do the job without preventing ajax requests to be profiled ?

Sairahcaz commented 1 year ago

I'll have a look at this the next days...

Sairahcaz commented 1 year ago

@gaetan-hexadog as the GUI repo is not really maintained any longer and PRs will not get merged, I for now just recommend to remove or comment out the echo '<a href ... in the public/vendor/xhprof/external/footer.php(19) by hand. I'll point that out in the README...