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

cy.request qs parameter doesn't handle nested objects anymore #25341

Open
nicooprat opened this issue Jan 3, 2023 · 5 comments
Open

cy.request qs parameter doesn't handle nested objects anymore #25341

nicooprat opened this issue Jan 3, 2023 · 5 comments
Labels
E2E Issue related to end-to-end testing existing workaround prevent-stale mark an issue so it is ignored by stale[bot] Reproducible Can be reproduced type: regression A bug that didn't appear until a specific Cy version release v12.0.0 🐛

Comments

@nicooprat
Copy link

Current behavior

Calls the following endpoint (I removed the encoding to make it clearer):

https://test.com?nested=[object Object]

Desired behavior

Should call the following endpoint:

https://test.com?nested[foo]=bar

Test code to reproduce

cy.request({
	method: 'GET',
	url: 'https://test.com',
	qs: {
		nested: {
			foo: 'bar'
		}
	}
})

Cypress Version

12.2.0

Node version

16.19.0

Operating System

macOS 12.6

Debug Logs

No response

Other

Seems to appeared since version 12. I think it's coming from this change: #20302

For now I use the qs package and use the request like this as a workaround:

cy.request({
	method: 'GET',
	url: `https://test.com?${qs.stringify({nested: {foo: 'bar'}})}`,
})

I couldn't find anything in the changelog or the docs how to migrate this breaking change. Did I miss something obvious?

@astone123
Copy link
Contributor

Thanks @nicooprat, I was able to reproduce this. Routing to the e2e team

@astone123 astone123 removed their assignment Jan 6, 2023
@ntsyhaniuk
Copy link

I have the same issue

My query params are:

      qs: {
        filters: [
          { operator: '$eq', field: 'active', value: true },
          {
            operator: '$contains',
            field: 'title',
            value: 'E2E',
            optionDisplayName: 'contains',
          },
        ],
      },

Actual request was sent to:
https://bla-bla.com?filters=%5Bobject%20Object%5D%2C%5Bobject%20Object%5D

@nagash77 nagash77 added E2E Issue related to end-to-end testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. and removed routed-to-e2e labels Apr 19, 2023
@sciborski
Copy link

Any updates on this issue?

@jennifer-shehane jennifer-shehane added Reproducible Can be reproduced type: regression A bug that didn't appear until a specific Cy version release labels Dec 21, 2023
@jennifer-shehane jennifer-shehane added v12.0.0 🐛 existing workaround and removed Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. labels Jan 2, 2024
@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Jul 1, 2024
@nicooprat
Copy link
Author

Still happening in Cypress 13.12.0

image

@jennifer-shehane jennifer-shehane added prevent-stale mark an issue so it is ignored by stale[bot] and removed stale no activity on this issue for a long period labels Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E2E Issue related to end-to-end testing existing workaround prevent-stale mark an issue so it is ignored by stale[bot] Reproducible Can be reproduced type: regression A bug that didn't appear until a specific Cy version release v12.0.0 🐛
Projects
None yet
Development

No branches or pull requests

7 participants