File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ import type { User } from "./users"
25
25
/**
26
26
* You should always upload files and/or create users
27
27
* before login, so that the cookies are NOT YET defined.
28
- *
28
+ *
29
29
* @see https://docs.cypress.io/api/commands/session
30
30
*/
31
31
export const login = function ( user : User ) {
@@ -35,13 +35,15 @@ export const login = function(user: User) {
35
35
cy . request ( {
36
36
method : 'POST' ,
37
37
url : '/login' ,
38
- body : {
39
- user : user . userId ,
40
- password : user . password ,
38
+ body : {
39
+ user : user . userId ,
40
+ password : user . password ,
41
41
requesttoken : requestToken
42
42
} ,
43
43
headers : {
44
44
'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/' , '' ) ,
45
47
} ,
46
48
followRedirect : false ,
47
49
} )
You can’t perform that action at this time.
0 commit comments