Writing async APIs using Gin

I need to write an API endpoint which returns control to the user almost immediately but continues processing the request asynchronously. I am handling this by starting a go routine that handles the processing and the main calling go routine sets status to 200 and returns.

But I get this error: http: invalid Read on closed Body

Hi @tashi21,

The error typically happens if code tries to read the request body after flushing the ResponseWriter.

Here is a longer answer:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.