Update the previous mock server with the following:
Hello World variant of 'get/message' request to
Start mock server and test Step 1
Now add data for setMockId for /get/message and /get/number routes.
Return the following for URL hit count 1
{
"message" : 1
}
{
"number" : 1
}
Return the following for URL hit count 2
{
"message" : 2
}
{
"number" : 2
}
Return the following for default
{
"message" : "Undefined"
}
{
"number" : "Undefined"
}
Call API to setMockId to the folder name via Midway UI
Hit the rest endpoint /get/message and /get/number one time each and verify the response is "message" : 1 and "number" : 1 respectively.
Hit the rest endpoint /get/message and /get/number once more and verify the response for second hit is "message" : 2 and "number" : 2 respectively.
Hit the rest endpoint /get/message and /get/number one more time to verify that the response is "message" : "undefined" and "number" : "undefined" respectively.
Call ResetMockId API via Midway UI
Hit the rest endpoint /get/message and /get/number once each and verify the response is based on the handler and not on SetMockId - You may have to add appropriate file based on the route path.
Update run-mock-server-console.js to add two parallel sessions to the server.
Now call GetSessionId to register a session using Midway UI.
Now set Hello World and Hello Universe variant for get/message api for the two sessions Ids respectively.
Now hit the server https://localhost:8000/sessionId/get/message for different session Ids and verify that you get different responses as per each variant.