Is there a possibility to cancel a respondOutputSt...
# ktor
Is there a possibility to cancel a respondOutputStream call in case an error occurs during writing to the outputstream and respond with a specified http status code? Currently the request just gives me an empty response but with sucess status 200
Copy code
call.respondOutputStream {
I could only find following question on stackoverflow:
I’m not sure there’s anything that can be done if you’ve already already started writing (200 OK already sent and perhaps first body bytes sent), but you may be able to defer opening the output stream until you’ve verified what you need to.
That's my current solution for the problem. Doing the fileprocessing first and if that is successful then writing to the outputstream. This allows to separate successful and error case.