-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warning on content length always displayed on import. #763
Comments
Can you post the 2 simulation.json files @dpm3354 ? Or send them privately? |
Sorry, John. I can't put more time into this right now. And I already deleted the files. Did you try on your own with your own file? |
Paul, we have not managed to reproduce a problem. That is, as long as we preserve the content length correctly the warning does not appear. As soon as we add or subtract characters we see the warning. We decided that Hoverfly should not automatically adjust the Content-Length as it may be the intent to simulate an incorrect correct-length and it would be more confusing to second-guess intentions. It's also very complicated to calculate the content length when the user has used templating. As the warning says you can adjust the content-length or remove the header, in which case Hoverfly will default to use Transfer-Encoding chunked to read the body. Can you try again. If you see the same problem please supply us with the 'before' and 'after' JSON files. |
I'm seeing this warning too, I think it might happen when the body of the response is encoded. During this check https://github.com/SpectoLabs/hoverfly/blob/master/core/import.go#L162 maybe |
Thanks @john4744 - we'll have a look at that. |
Hey @john4744, What a great spot. When I was testing this, I was trying with JSON apis, so Hoverfly would not encode the response bodies. I've just tried this with an image (guaranteed to get encoded by Hoverfly) and was able to recreate the problem. I have attached a simulation with an encoded body that triggered the error for me with Hoverfly v0.17.3. I will look into fixing this now. |
The problem reported by @john4744 has been fixed in v0.1.7.5 We can't tell if we have fixed the original issue but given we haven't had any further info I'm closing this issue. Feel free to reopen if there is a bug. |
I see the fix for the content length I mentioned, but there appears to be a problem with it. I’m guessing someone forgot to test this….
Case #1 - Change the simulation.json file after export and before import. Make sure the number of characters in the body DOES NOT CHANGE. For instance, I changed one ascii character in the body to a different ascii character, but the length of the body did not change.
552 hoverctl start
553 hoverctl stop
554 hoverctl start
555 hoverctl logs
556 hoverctl mode capture
557 hoverctl logs
558 hoverctl export simulation.json
559 hoverctl stop
560 hoverctl start
561 hoverctl import simulation.json (edited)
That’s my history.
between #558 and #561 I did NOT change the simulation.json file.
But I still get this warning after the cmd at line 561: “WARNING: Response contains incorrect Content-Length header on data.pairs[1].response, please correct or remove header”
If the content didn’t change, the warning should not appear.
Case #2 - Change nothing in the simulation.json file after export and before import.
Notice the warning for content length is echoed twice to the console.
The text was updated successfully, but these errors were encountered: