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 support for Ajax requests with X-CSRF header #98

Closed
wants to merge 8 commits into from

Conversation

Projects
None yet
1 participant
@odan
Copy link

commented Mar 11, 2019

This PR will add support for Ajax requests with X-CSRF http headers.

Currentlythe header names X-CSRF-NAME and X-CSRF-VALUE are fixed and not configurable. If necessary, this could be added later.

Usage

Twig and jQuery

Example:

<script>
    $.ajaxSetup({
        beforeSend: function (xhr) {
            xhr.setRequestHeader("X-CSRF-NAME", "{{ csrf.name }}");
            xhr.setRequestHeader("X-CSRF-VALUE", "{{ csrf.value }}");
        }
    });
</script>

odan added some commits Mar 11, 2019

Removed hhvm to fix composer issue
Fatal error: Uncaught exception 'InvalidArgumentException'
with message 'array_pop() expects parameter 1 by reference
in src/Composer/Util/Silencer.php:51

@odan odan closed this Apr 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.