Skip to content

cy.visit() and URL encoding #5034

@Doogiemuc

Description

@Doogiemuc

Current behavior:

Cypress does not support URL encoding at all. Ok I know this is the responsible of the HTTP 'client', but it would be nice if the cy.visit() function would support URL encoding in a similar way as any other JS REST client does.

Just for clarification: I am talking about URL parameters. Not HTTP headers. And also not POST body.

Desired behavior:

cy.visit() should have a parameter params of type object. The passed values in this object will be URL encoded and then all attributes are sent as parameters in the request URL.

Steps to reproduce: (app code and test code)

This code should work:

    cy.visit('/search, { params: { searchQuery: "some example string with spaces" }}
    // => GET /search?searchQuery=some%20example%20string%20with%20spaces
   
    cy.visit({
      method: 'GET',
      url: '/fetch
      params: {
        foo: 'bar'
      }
    }
    // =>GET /fetch?foo=bar

Versions

all cypress versions. Yes ok, this is a feature request.

Metadata

Metadata

Assignees

Labels

type: featureNew feature that does not currently exist

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions