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(): allow cy.request not to fail under non 2xx/3xx status codes #307

Closed
tormoseng opened this issue Nov 22, 2016 · 5 comments
Closed
Assignees
Labels
type: enhancement Requested enhancement of existing feature
Milestone

Comments

@tormoseng
Copy link

I need to strip out a token from a request that returns HTTP 401. That is currently not possible.

@jennifer-shehane jennifer-shehane added the type: enhancement Requested enhancement of existing feature label Nov 29, 2016
@brian-mann brian-mann self-assigned this Dec 4, 2016
@brian-mann
Copy link
Member

So after looking at this... this is actually already part of cy.request and was documented here:

https://docs.cypress.io/v1.0/docs/request#section-options

You just need to pass failOnStatus: false.

@brian-mann
Copy link
Member

Fixed in 0.18.1.

@brian-mann brian-mann reopened this Dec 12, 2016
@brian-mann brian-mann added this to the 0.18.1 milestone Dec 19, 2016
@cmpDrone
Copy link

@Team - I am new to this so, i need the syntax as to how to pass the failOnStatus: false and where do i pass this

@cmpDrone
Copy link

cmpDrone commented Nov 16, 2017

I found the solution myself -

cy.request({
  method:'POST',
  url:'https://xxxx.in', 
  body:{userName: "ghnfhg", password: "ghnfhg"},
  failOnStatusCode: false
})

@brian-mann
Copy link
Member

It's in the documentation here https://docs.cypress.io/api/commands/request.html#Usage

it's also in many recipes you just need to search for cy.request

@cypress-io cypress-io locked as resolved and limited conversation to collaborators Dec 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement Requested enhancement of existing feature
Projects
None yet
Development

No branches or pull requests

4 participants