Skip to content

Commit

Permalink
feat: Send Origin header in login request
Browse files Browse the repository at this point in the history
This is need as the server is now checking that header too: nextcloud/server#49560

Signed-off-by: Louis Chemineau <[email protected]>
  • Loading branch information
artonge committed Dec 4, 2024
1 parent fcab040 commit 201a4a4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/commands/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { User } from "./users"
/**
* You should always upload files and/or create users
* before login, so that the cookies are NOT YET defined.
*
*
* @see https://docs.cypress.io/api/commands/session
*/
export const login = function(user: User) {
Expand All @@ -18,13 +18,15 @@ export const login = function(user: User) {
cy.request({
method: 'POST',
url: '/login',
body: {
user: user.userId,
password: user.password,
body: {
user: user.userId,
password: user.password,
requesttoken: requestToken
},
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
// Add the Origin header so that the request is not blocked by the browser.
'Origin': (Cypress.config('baseUrl') ?? '').replace('index.php/', ''),
},
followRedirect: false,
})
Expand Down

0 comments on commit 201a4a4

Please sign in to comment.