Skip to content

When using 'mage/storage'.post() in admin and passing 'form_key' in json encoded, condition isn't fulfilled #37855

Open
@robertd-eclipse

Description

@robertd-eclipse

When sending data

JSON.stringify({
...
        form_key: form_key
...
})

in 'mage/storage'.post(url, data) to the REST endpoint

the form_key isn't found because it is searching for 'form_key=' and not 'form_key'

settings.data.indexOf('form_key=') === -1) {

and it is adding to the encoded json string '{}'&form_key=xyz, what makes an exception in
[64 line] \Magento\Framework\Webapi\Rest\Request\Deserializer\decodedBody

To bypass this I have added in data

JSON.stringify({
...
       'form_key=': form_key
...
})

is there a reason why in
lib/web/mage/backend/bootstrap.js#L46 it is comparing 'form_key=' and not just 'form_key'?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: FrameworkComponent: BackendIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for devReported on 2.4.xIndicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions