Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Test delayed data streaming #109

Closed
tir38 opened this issue Oct 29, 2019 · 3 comments
Closed

Test delayed data streaming #109

tir38 opened this issue Oct 29, 2019 · 3 comments

Comments

@tir38
Copy link
Contributor

tir38 commented Oct 29, 2019

I have a PUT request that slowly streams bytes to a server. Internal to this call I track total bytes uploaded. I now want to write a test asserting that X bytes were uploaded. To do this I mostly need to keep RESTMock from immediately returning 200. It should let me write some bytes and only later return a response code. IIUC from other issues, .delay() operator only delays the response body, not the response code. Is there any way to change this?

@andrzejchm
Copy link
Owner

0.4.1 version adds a delayHeaders(...) method which does delay the http response codes

@tir38
Copy link
Contributor Author

tir38 commented Dec 18, 2019

Tested and works great. Thanks!

@tir38
Copy link
Contributor Author

tir38 commented Jul 21, 2020

Sorry for the late return but I figured out part of the reason this was not working. We also have a "Expect: 100-continue" header on that request. So the bug was not that restmock was delaying the response header. It was that MockWebServer was delaying the initial 100 response. When I said back in Dec that things were working, they only worked if I removed that header. Seems like this is a known issue in MockWebServer square/okhttp#4698

Either way thanks for adding this part.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants