Skip to content

Unexpected api /logout behavior #1592

Open
@unlikelyzero

Description

@unlikelyzero

While developing a test for api /logout #1591 , I ran into the following /logout behavior:

Expected Behavior

  1. Authenticated session
  2. POST /logout
  3. Expect a 2xx or 3xx and a message in json for ~success

Actual Behavior

  1. Authenticated session
  2. POST /logout
  3. 404 HTML Cannot GET

I've included the code on a PR here: #1593

Error output:

The response we received from your web server was:

  > 404: Not Found

This was considered a failure because the status code was not `2xx` or `3xx`.

If you do not want status codes to cause failures pass the option: `failOnStatusCode: false`

-----------------------------------------------------------

The request we sent was:

Method: POST
URL: http://localhost:3001/logout
Headers: {
  "Connection": "keep-alive",
  "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Cypress/13.15.1 Chrome/118.0.5993.159 Electron/27.3.10 Safari/537.36",
  "accept": "*/*",
  "cookie": "connect.sid=s%3AWWIBdPNneqJkOTI326qQGFFzIg3UuDUt.JfOgKrOJzPPKp%2F5rVmAAeYGfhcxRtAwQROgDVk3sxoE",
  "accept-encoding": "gzip, deflate",
  "referer": "http://localhost:3001/logout"
}
Redirects: [
  "302: http://localhost:3001/"
]

-----------------------------------------------------------

The response we got was:

Status: 404 - Not Found
Headers: {
  "x-powered-by": "Express",
  "access-control-allow-origin": "http://localhost:3000",
  "vary": "Origin",
  "access-control-allow-credentials": "true",
  "content-security-policy": "default-src 'none'",
  "x-content-type-options": "nosniff",
  "content-type": "text/html; charset=utf-8",
  "content-length": "139",
  "date": "Sun, 03 Nov 2024 16:54:54 GMT",
  "connection": "keep-alive",
  "keep-alive": "timeout=5"
}
Body: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /</pre>
</body>
</html>

https://on.cypress.io/request
      at <unknown> (http://localhost:3000/__cypress/runner/cypress_runner.js:132719:72)
      at tryCatcher (http://localhost:3000/__cypress/runner/cypress_runner.js:1807:23)
      at Promise._settlePromiseFromHandler (http://localhost:3000/__cypress/runner/cypress_runner.js:1519:31)
      at Promise._settlePromise (http://localhost:3000/__cypress/runner/cypress_runner.js:1576:18)
      at Promise._settlePromise0 (http://localhost:3000/__cypress/runner/cypress_runner.js:1621:10)
      at Promise._settlePromises (http://localhost:3000/__cypress/runner/cypress_runner.js:1701:18)
      at _drainQueueStep (http://localhost:3000/__cypress/runner/cypress_runner.js:2407:12)
      at _drainQueue (http://localhost:3000/__cypress/runner/cypress_runner.js:2400:9)
      at Async._drainQueues (http://localhost:3000/__cypress/runner/cypress_runner.js:2416:5)
      at Async.drainQueues (http://localhost:3000/__cypress/runner/cypress_runner.js:2286:14)
  From Your Spec Code:
      at Context.eval (webpack://cypress-realworld-app/./cypress/support/commands.ts:96:12)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions