@@ -59,7 +59,7 @@ import { resetOverrideLogs, logOverrideEvent, getOverrideLogs } from "./override
5959import Dashboard from "../../../recipe/dashboard" ;
6060import DashboardRecipe from "../../../lib/build/recipe/dashboard/recipe" ;
6161import { TypeInput as WebauthnTypeInput } from "../../../lib/build/recipe/webauthn/types" ;
62-
62+ import morgan from "morgan" ;
6363const { logDebugMessage } = logger ( "com.supertokens:node-test-server" ) ;
6464
6565const API_PORT = Number ( process . env . API_PORT || 3030 ) ;
@@ -163,6 +163,7 @@ function initST(config: any) {
163163 "Session.getCookieNameForTokenType" ,
164164 getCookieNameForTokenType
165165 ) ,
166+ getTokenTransferMethod : ( ) => config . getTokenTransferMethod ?? "any" ,
166167 override : {
167168 apis : overrideBuilderWithLogging ( "Session.override.apis" , config ?. override ?. apis ) ,
168169 functions : overrideBuilderWithLogging (
@@ -387,13 +388,23 @@ function initST(config: any) {
387388 supertokens . init ( init ) ;
388389}
389390
391+ morgan . token ( "body" , function ( req , res ) {
392+ return JSON . stringify ( req . body ) ;
393+ } ) ;
394+
395+ morgan . token ( "res-body" , function ( req , res ) {
396+ return typeof res . __custombody__ === "string" ? res . __custombody__ : JSON . stringify ( res . __custombody__ ) ;
397+ } ) ;
398+
390399const app = express ( ) ;
391400app . use ( express . json ( ) ) ;
392401app . use ( ( req , res , next ) => {
393402 logDebugMessage ( req . method , req . path ) ;
394403 next ( ) ;
395404} ) ;
396405app . use ( middleware ( ) ) ;
406+ app . use ( morgan ( "[:date[iso]] :url :method :body" , { immediate : true } ) ) ;
407+ app . use ( morgan ( "[:date[iso]] :url :method :status :response-time ms - :res[content-length] :res-body" ) ) ;
397408
398409app . get ( "/test/ping" , async ( req , res , next ) => {
399410 res . json ( { ok : true } ) ;
0 commit comments