Skip to content

Commit

Permalink
FCRM-4556 FMP_SESSION cookie set on location - test random server number
Browse files Browse the repository at this point in the history
  • Loading branch information
markfee committed Nov 23, 2023
1 parent fba868e commit 74ed6a5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/routes/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let randomServerIdentifier

const getRandomServerIdentifier = () => {
if (!randomServerIdentifier) {
randomServerIdentifier = Math.round(Math.random() * 1000)
randomServerIdentifier = Math.round(Math.random() * 10000)
}
return `\n\nServer-${randomServerIdentifier}\n\n`
}
Expand All @@ -32,14 +32,15 @@ module.exports = [{
description: 'Get location for a postcode, national grid reference, easting or northing'
},
handler: async (request, h) => {
const fmpSession = request.state.FMP_SESSION || `${Math.random()}`
const serverId = getRandomServerIdentifier()
const errors = []
const model = new LocationViewModel({
placeOrPostcodeSelected: true,
errorSummary: errors
})
model.randomServerIdentifier = serverId
return h.view('location', model)
return h.view('location', model).state('FMP_SESSION', fmpSession)
}
},
{
Expand Down

0 comments on commit 74ed6a5

Please sign in to comment.