function getSettingsCookie (response) { try { const cookies = response.headers['set-cookie'] const settingsCookie = cookies.find((cookie) => cookie.startsWith('theExampleAppSettings=')) const parsedCookie = cookie.parse(settingsCookie) return cookieParser.JSONCookie(parsedCookie.theExampleAppSettings) } catch (err) { throw new Error(`Settings cookie was not set or could not be parsed. ${err.message}`) } }