MaxJSONSize and MaxXMLSize must be greater than zero#114
MaxJSONSize and MaxXMLSize must be greater than zero#114mstgnz wants to merge 250 commits intotsawler:mainfrom
Conversation
Development
test new function
Development
add DownloadStaticFile
Update tests for DownloadStaticFile
Correct test names
automate tests
Development
rename action
fix readme badge
add type to readme
improve tests
Update readme
Update readme
Add file upload tool
improve tests & allow for custom max file upload size.
improve test
Development
remove badge
Add example to readme
Add example to readme
Improve error message.
Add XML header to output.
correct path in badge
set larger default upload size
Development
Update tests
|
Hi @tsawler I integrated the InArray and LoadSQLQueries methods into the tools package. InArray can check if the searched key exists in all arrays, regardless of their type. LoadSQLQueries allows us to use SQL codes in SQL files instead of using them in code, thus avoiding code pollution. I thought it would be good to have them in a toolbox. |
|
Thanks for this. I'll give it a look as soon as I can. |
|
|
||
| // If MaxJSONSize is set, use that value instead of default. | ||
| if t.MaxJSONSize != 0 { | ||
| if t.MaxJSONSize > 0 { |
There was a problem hiding this comment.
Therefore, instead of checking whether MaxJSONSize and MaxXMLSize values are equal to zero, I checked whether they are greater than zero. This way, even if a negative value is entered, the tests are successful. Of course, alternatively, it could be considered to return an error by checking whether MaxJSONSize and MaxXMLSize values are less than zero. You know better which approach is more effective.
mstgnz
left a comment
There was a problem hiding this comment.
I didn't write a test for whether the sql file is valid or not. You can write a test for this, but I don't know if it is necessary.
Hello,
I have thoroughly enjoyed watching almost all of your courses on Udemy. First and foremost, thank you very, very much for these valuable lessons.
I was following your Tools package course, and a question arose in my mind regarding Json. Therefore, I forked the Toolbox project and tested the issue that puzzled me.
It seems that if MaxJSONSize and MaxXMLSize values are not equal to zero, they are being paired with defaultMaxUpload. In the tests, since these values are always positive numbers, the tests were successful. However, when a negative value was entered, it was not equal to zero, so the entered negative value was assigned, causing the tests to fail.
Therefore, instead of checking whether MaxJSONSize and MaxXMLSize values are equal to zero, I checked whether they are greater than zero. This way, even if a negative value is entered, the tests are successful. Of course, alternatively, it could be considered to return an error by checking whether MaxJSONSize and MaxXMLSize values are less than zero. You know better which approach is more effective.
Since there is no explanation about contributing, I hesitated about the pull request. Nevertheless, I thought I would try my luck.