Skip to content

Commit

Permalink
fixes for e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhpoddar committed May 8, 2024
1 parent 7c05c19 commit 4c98e69
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions test/frontendIntegration/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ func callSTInit(enableAntiCsrf bool, enableJWT bool, jwtPropertyName string) {
antiCsrf = "VIA_TOKEN"
}
err := supertokens.Init(supertokens.TypeInput{
OnSuperTokensAPIError: func(err error, req *http.Request, res http.ResponseWriter) {
res.Header().Set("Content-Type", "text/html; charset=utf-8")
res.WriteHeader(500)
res.Write([]byte(err.Error()))
},
Supertokens: &supertokens.ConnectionInfo{
ConnectionURI: "http://localhost:9000",
},
Expand Down Expand Up @@ -142,6 +147,11 @@ func callSTInit(enableAntiCsrf bool, enableJWT bool, jwtPropertyName string) {
antiCsrf = "VIA_TOKEN"
}
err := supertokens.Init(supertokens.TypeInput{
OnSuperTokensAPIError: func(err error, req *http.Request, res http.ResponseWriter) {
res.Header().Set("Content-Type", "text/html; charset=utf-8")
res.WriteHeader(500)
res.Write([]byte(err.Error()))
},
Supertokens: &supertokens.ConnectionInfo{
ConnectionURI: "http://localhost:9000",
},
Expand Down Expand Up @@ -196,6 +206,11 @@ func callSTInit(enableAntiCsrf bool, enableJWT bool, jwtPropertyName string) {
antiCsrf = "VIA_TOKEN"
}
err := supertokens.Init(supertokens.TypeInput{
OnSuperTokensAPIError: func(err error, req *http.Request, res http.ResponseWriter) {
res.Header().Set("Content-Type", "text/html; charset=utf-8")
res.WriteHeader(500)
res.Write([]byte(err.Error()))
},
Supertokens: &supertokens.ConnectionInfo{
ConnectionURI: "http://localhost:9000",
},
Expand Down Expand Up @@ -349,8 +364,9 @@ func reinitialiseBackendConfig(w http.ResponseWriter, r *http.Request) {

func featureFlag(response http.ResponseWriter, request *http.Request) {
json.NewEncoder(response).Encode(map[string]interface{}{
"sessionJwt": maxVersion(supertokens.VERSION, "0.3.1") == supertokens.VERSION && lastEnableJWTSetting,
"v3AccessToken": maxVersion(supertokens.VERSION, "0.12.0") == supertokens.VERSION,
"sessionJwt": maxVersion(supertokens.VERSION, "0.3.1") == supertokens.VERSION && lastEnableJWTSetting,
"v3AccessToken": maxVersion(supertokens.VERSION, "0.12.0") == supertokens.VERSION,
"duplicateCookieHandling": maxVersion(supertokens.VERSION, "0.19.0") == supertokens.VERSION,
})
}

Expand Down

0 comments on commit 4c98e69

Please sign in to comment.