Skip to content

Commit b65ed5f

Browse files
committed
feat: Send Origin header in login request
This is need as the server is now checking that header too: nextcloud/server#49560 Signed-off-by: Louis Chemineau <[email protected]>
1 parent 5194aa1 commit b65ed5f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/commands/sessions.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import type { User } from "./users"
2525
/**
2626
* You should always upload files and/or create users
2727
* before login, so that the cookies are NOT YET defined.
28-
*
28+
*
2929
* @see https://docs.cypress.io/api/commands/session
3030
*/
3131
export const login = function(user: User) {
@@ -35,13 +35,15 @@ export const login = function(user: User) {
3535
cy.request({
3636
method: 'POST',
3737
url: '/login',
38-
body: {
39-
user: user.userId,
40-
password: user.password,
38+
body: {
39+
user: user.userId,
40+
password: user.password,
4141
requesttoken: requestToken
4242
},
4343
headers: {
4444
'Content-Type': 'application/x-www-form-urlencoded',
45+
// Add the Origin header so that the request is not blocked by the browser.
46+
'Origin': (Cypress.config('baseUrl') ?? '').replace('index.php/', ''),
4547
},
4648
followRedirect: false,
4749
})

0 commit comments

Comments
 (0)