Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Status Strings for all response codes in use #13
Thanks for the PR!
It looks quite good, but if we need more than the five most common REST status codes, we'll have to add many
I thought about adding a lookup-table using a
Would you mind adding such a dictionary or even extract this behaviour to a
I also thought about using a dictionary, but I was tired and somehow came to the conclusion that I shouldn't reference the Scripting library unless it was absolutely necessary. That logic doesn't hold up
I will make your proposed changes tomorrow: I am traveling for Christmas and don't have a Windows Machine to test with. Merry Christmas!
I thought about ways to pass the status message to the response without initializing/attaching a dictionary to every instance of HttpResponse. Creating a static variable is more difficult in VBA than I expected.
I have extracted the lookup to a new module, and included every HTTP Status Code, including 418 ;)
There are 2 iterations of public static lookup included among these commits. The older one uses a function that uses many ElseIfs, because of the difficulty of making a dictionary global. I personally don't consider this a maintenance issue as much as a file size issue. The living HTTP standard doesn't change that frequently.
Regardless, I did pursue an option that uses a dictionary. It is declared public in the module, and requires an initializer sub which is called from the main method. I made it so the sub isn't visible in the list of macros. Obviously the benefit over the other function solution is that key-value pairs can be iterated if needed. Although I feel like I have put a blemish on the application's very short main method. I don't know best practices for VBA, but my experience with other languages tells me this is an appropriate place to use a global dictionary.