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

Add optional request header to disable debugbar response injection #547

Closed
wants to merge 1 commit into from

Conversation

StevenBock
Copy link

@StevenBock StevenBock commented Sep 8, 2016

This adds an optional header that you can add to your request to disable the debugbar data collection/response injection. I looked through the code and could not find anything obvious to do this.

I experienced the initial issue with running the Node Laravel Echo Server. When joining a private channel, it sends an HTTP request to the broadcasting auth endpoints, which in turn replies "true" if the user can join the channel. However, in a development environment with response injection enabled, the debugbar injection happens and the echo server is unable to parse the reply (it's expecting JSON) correctly. Having a way to disable the injection with this request would remediate this issue.

I hope this is useful and if something is obviously wrong, any pointers would be great. This is my #1 pull request on an open source project!

@barryvdh
Copy link
Owner

barryvdh commented Sep 8, 2016

It shouldn't inject in Ajax requests or json respones, so are you sure your using the correct responses?

@StevenBock
Copy link
Author

StevenBock commented Sep 8, 2016

Hmm, it looks like it's sending a standard POST request. https://github.com/tlaverdure/laravel-echo-server/blob/master/src/echo-server.ts#L451

Might be we can send it as an AJAX request and skip the need for this. I'll do some investigation.

@StevenBock
Copy link
Author

Ok, so setting options.headers['X-Requested-With'] = 'XMLHttpRequest'; does indeed fix the issue with the response being modified. So I suppose this pull request is not needed, although it might be nice to have some way to completely disable the debugbar without having to send your request as an AJAX call.

Thanks for your time!

@StevenBock StevenBock closed this Sep 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants