Closed idanto closed 6 years ago
Totals | |
---|---|
Change from base Build 103: | 0.02% |
Covered Lines: | 188 |
Relevant Lines: | 188 |
Totals | |
---|---|
Change from base Build 103: | 0.02% |
Covered Lines: | 188 |
Relevant Lines: | 188 |
Totals | |
---|---|
Change from base Build 103: | 0.08% |
Covered Lines: | 208 |
Relevant Lines: | 208 |
@igor-savin-ht you can review, If you have any good idea to handle the last open issue feel free to share.
Basically, I think everything is ready for review, I solved all the issues by not setting the content-type header as required and using a regex for validation. @igor-savin-ht @kibertoad can you please review?
@idanto Would it be possible to skip validation in case body is empty? That sounds to be a more valid approach.
@kibertoad It's much harder to implement, cause the whole idea behind ajv is the pre-compiled schema and currently the body and all other parameters are two different schemas. I can check if there is a conditional check in Ajv and think how to indicate that there is something in the body but it will take me some time to solve.
I'm with you, If you have time to check it for me I will implement.
@idanto Probably the easiest solution at this point is to make this check optional and disable by default, so that no existing requests start failing, and whoever needs this check, could opt-in.
Please do not merge this one, I found an issue with the code - it is application/json
specific and doesn't fully support the swagger spec.
I would like also to make this optional as @kibertoad suggested
@idanto Can we move the validation outside of ajv call and check the header manually?
@kibertoad Please review again:
content-length
is higher than 0@idanto Can I merge it?
Added header for header validation. The only case that isn't covered is in case the body can be empty, in this case, the validation won't be smart and will fail if the header is missing.
Resolve #17