Closed natenho closed 2 years ago
Describe the bug In situations where the client is expecting only the response header, the delay attribute won't take effect.
To Reproduce Given the following template:
{ "request": { "method": "GET" }, "response": { "delay": 8000, "status": "OK", "body": { "message": "This should not be received before 8sec" } } }
Running curl is enough to notice the behavior: curl -i http://localhost:5000
curl -i http://localhost:5000
Expected behavior The entire request (including headers) should delay.
Additional context Mockaco delay is processed after all writes are made to the Http Response stream, so any partial chunks would be sent to the client before the response is finished. https://github.com/natenho/Mockaco/blob/0721dfc483cc7dac3a9c3423ab1760973815d84f/src/Mockaco/Middlewares/ResponseDelayMiddleware.cs#L38 https://github.com/natenho/Mockaco/blob/0721dfc483cc7dac3a9c3423ab1760973815d84f/src/Mockaco/Middlewares/ResponseMockingMiddleware.cs#L48
Describe the bug In situations where the client is expecting only the response header, the delay attribute won't take effect.
To Reproduce Given the following template:
Running curl is enough to notice the behavior:
curl -i http://localhost:5000
Expected behavior The entire request (including headers) should delay.
Additional context Mockaco delay is processed after all writes are made to the Http Response stream, so any partial chunks would be sent to the client before the response is finished. https://github.com/natenho/Mockaco/blob/0721dfc483cc7dac3a9c3423ab1760973815d84f/src/Mockaco/Middlewares/ResponseDelayMiddleware.cs#L38 https://github.com/natenho/Mockaco/blob/0721dfc483cc7dac3a9c3423ab1760973815d84f/src/Mockaco/Middlewares/ResponseMockingMiddleware.cs#L48