try-with-resources to close stream when reading content from payload
try-with-resources to close stream when writing payload to http response
sanity check that PayloadResponse is non-null