I already solved it. Turns out if you do the if check outside of the handler function the test fails for some reason even though you get the exact same result
You don’t get the exact same result though. If you check the environment variable in the global scope, then your app does not respond to changes to the environment variable.
Yes it did, i checked multiple times. I changed the environment variable’s value to “asd” (without quotations of course) and the message would be lowercase
Placing the line of code where you check the value of the environment variable outside of the handler function means that the environment variable is checked only once, when the application first starts.
However, when you check the value of the environment variable inside the handler function, then you check the value of the environment variable every time the handler function is called.
This difference is important because the test suite sends a command to your application to change the environment variable while the application is running. If you do not check the value of the environment variable inside of your handler, then it is literally impossible for your handler to respond to this change.
Manually changing the environment variable involves restarting the application, which isn’t how the test suite works. It also isn’t how you would want a real world application to work. You shouldn’t need to restart the application to change this behavior.
No worries. It took me a while to figure out what was up the first time I saw someone have ttis issue since I’ve not done a lot of this sort of development.
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.
Hi JeremyLT, Ok thanks yes that makes a lot of sense so that the other people go through the same learning process and headaches that we had. Yes, totally. This was a difficult one for me to understand as well.