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

Support arbitrary list of methods, (Cf: Express) #1302

Closed
NoMan2000 opened this Issue Feb 12, 2018 · 8 comments

Comments

6 participants
@NoMan2000
Copy link

NoMan2000 commented Feb 12, 2018

Is this a Feature or Bug?

Feature.

Current behavior:

Currently, when using cy.request, you are limited to a handful of the most popular HTTP verbs. However, there are far more verbs than the official ones, such as in express API. Without supporting these, it makes it hard to test methods like subscribe and unsubscribe.

Desired behavior:

Allow arbitrary HTTP methods to be used.

How to reproduce:

cy.request({
        method: 'SUBSCRIBE',
        url: `users/1`,
        body: email
      }).then(() => {});

Result: CypressError: cy.request() was called with an invalid method: 'SUBSCRIBE'. Method can only be: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS

Possibilities: Allow an extra flag to be checked that will turn off method checking.

@brian-mann

This comment has been minimized.

Copy link
Member

brian-mann commented Feb 13, 2018

Do you mind finding the code that express uses for this list... wanted to see if there was an npm package somewhere we could borrow from that lists them all out so we don't have to maintain them ourselves

@NoMan2000

This comment has been minimized.

Copy link
Author

NoMan2000 commented Feb 13, 2018

Sure. They're using the methods package.

https://www.npmjs.com/package/methods

Then loading that into the prototype:

https://github.com/expressjs/express/blob/master/lib/router/route.js

That's overkill though, I think the basic list from methods has what you're looking for.

https://github.com/jshttp/methods/blob/master/index.js

@brian-mann

This comment has been minimized.

Copy link
Member

brian-mann commented Feb 13, 2018

Perfect this is what I was looking for. We can add these to the driver. We'll uppercase them though when running them through the validation.

@cdanielsen

This comment has been minimized.

Copy link

cdanielsen commented Sep 17, 2018

Any sense for a timeline of when this will be integrated? I'm testing an app that has a file system like component that makes PROPFIND, MOVE, COPY etc. calls where this would be very useful

@jennifer-shehane

This comment has been minimized.

Copy link
Member

jennifer-shehane commented Jan 24, 2019

Need to make sure this works for cy.route() and cy.request()

@ivan-kleshnin

This comment has been minimized.

Copy link

ivan-kleshnin commented Jan 31, 2019

My APIs use SEARCH method which is a part of the current HTTP standard. Not even a custom verb. And I'm getting the same error. Not good 😞

@cypress-bot

This comment has been minimized.

Copy link

cypress-bot bot commented Mar 15, 2019

The code for this is done in cypress-io/cypress#3555, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot

This comment has been minimized.

Copy link

cypress-bot bot commented Mar 15, 2019

Released in 3.2.0.

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.