Skip to content

[WebProfilerBundle] JS error using Request as window.fetch param #20723

Closed
@OnekO

Description

@OnekO

If you try to use a Request object as window.fetch param, js will crash because:

if (!arguments[0].match(new RegExp({{ excluded_ajax_paths|json_encode|raw }}))) {

One easy solution is something like this before that line (line ~246, /symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig)

    var paramType = Object.prototype.toString.call(arguments[0]);
    if (paramType === '[object Request]') {
        arguments[0] = arguments[0].url;
        arguments[1] = {
            method: arguments[0].method,
            credentials: arguments[0].credentials,
            headers: arguments[0].headers,
            mode: arguments[0].mode,
            redirect: arguments[0].redirect
        };
    }

At least that's working for me, but it needs more testing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions