Merged
Conversation
The code being fixed in this commit does not use proper syntax to specify :pre conditions. As a result, when any of the predicate functions are provided with the `response` parameter that is not a map, instead of throwing an assertion error, execution reaches `(:status response)` whereupon it produces `NullPointerException`.
Member
|
thanks for the fix! There is https://github.com/metosin/ring-http-response/blob/master/dev/user.clj that is used to generate most of the code in the lib. updated the templates and will merge. |
Member
|
see 7093e08 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The code being fixed in this commit does not use proper syntax to specify :pre conditions. As a result, when any of the predicate functions are provided with the
responseparameter that is not a map, instead of throwing an assertion error, execution reaches(:status response)whereupon it producesNullPointerException.This might cause confusion as to the origin of the error because the developer might not know or remember the proper syntax of the :pre conditions, and upon seeing that some code is present in the
:preheader of the predicate functions they are using, they discard the possibility that it might be theresponseparameter they are providing to these functions that causes an error, assuming that the predicate functions take care of validating the proper type of theresponseparameter.Judging from the way
:precondition gets added to the function definition, current implementation uses the syntax which doesn't fail to operate only because theassertfunction returnsnilupon receiving a reference to a function and upon receiving the instance of the data type by itself, but the code does fail to fulfill its purpose, it doesn't really "work" as is.