-
Notifications
You must be signed in to change notification settings - Fork 370
stream validation fails #463
Comments
I'll look into it. |
update: it seems to be a problem with |
@whitlockjc, @SandyChapman, i made a test for this issue. i hope you can come up with a solution. |
I'll take a peek. |
To backpack onto this, it appears in my project that validations don't properly validate when using For example Should I make a separate issue? I want to also note that I am piping back JSON |
@smoebody @stv8 : I've had this PR open for some time now to address this issue I think. #367 Can either of you verify? If so, then maybe @whitlockjc would be kind enough to merge it. |
@SandyChapman I can confirm that your change fixes my problem |
@SandyChapman would you mind explaining what exactly your change does? I am a bit confused because it looks like it has to do with streaming files but I am just streaming a JSON response. Or is that basically the same thing as streaming a file? |
@stv8 : I believe what's fixing your problem is the portion of the code:
Based on my memory of 8 months ago and this comment, I think the validation occurs on any defined value. If val is undefined, the validation is skipped. Hence, if we write nothing to the output, we force the val to be undefined and bypass the validator. The fix has to do with there being different code paths for The rest of the code is just ensuring that if you are using a I'm going off my memory here as I'm not a JS dev and it's been a while so this might not be correct, but hopefully it's helpful. |
Thanks, I also think it might be this code you added as well. It appears to handle my JSON response because it is not a file but is an instance of buffer, which then sets val to be my JSON string. Now that val is defined it triggers the validations correctly.
|
i can confirm that it fixes this issue. conflicts need to be resolved manually though. @SandyChapman can you please have a look whether my test in PR #464 is obsolete by your PR's test or not? |
Once we get @smoebody's question answer, I'll take the appropriate course of action. Thanks for all the help everyone. |
@whitlockjc i merged @SandyChapman s fix in my PR #464 and resolved all conflicts. can you merge into master please? i need this :) http://giphy.com/gifs/tN1lvnT4M6nte |
@smoebody I think that the better way is to always pass original intact response data (captured by validation middleware) to sendData function (obviously in case of successful validation). |
this pull request resolve my problem |
Hi,
the master-code gives me a "double callback!" error when validating my file-response. i could nail it down to 17e77be, but i am fairly overwhelmed with what happens here. tag v0.10.1 works well.
this is my path-definition:
the controller responds with
res.sendFile(filePath)
. i try to provide a test for it soon but maybe somebody has an idea already.The text was updated successfully, but these errors were encountered: