Fix an issue for replies in onresponse mishandling headers

Reported and fixed over email by Adrian Roe.