I found how to fix this, but no satisfactory explanation.
I was using wrap-json-response
Ring middleware to take a HashMap and convert it to JSON. I switched to doing my own conversion in my handler with json/write-str
, and this fixes it.
At a guess it might be something to do with the server handling output buffering, but that's speculation.
I've combed through the Wireshark dumps and I can't see any relevant differences between the two. The sent Content-Length
fields are identical. The 'bytes in flight' differ, at 518 and 524.
No clue as to why the web browser was happy with this but Python Requests wasn't, and whether or this is a bug in Requests
, httpkit
, ring-middleware-format
or my own code.