Fix for gateway resource writing binary content of the 0 bytes length.