title: Go keep get scan file error: http: invalid Read on closed Body
body: <p>When I read 1000 records file, I keep get error message every 10~20 records:</p>
  
  <pre><code>scan file error: http: invalid Read on closed Body
  </code></pre>
  
  <p>Here is my code</p>
  
  <pre class="lang-golang prettyprint-override"><code>func parser(resp http.ResponseWriter, req *http.Request){
  
  var count int
  
  //....some of my code..
  
  resp.Header().Set("Content-Type", "text/plain")
      scanner := bufio.NewScanner(req.Body)
  
      ctx := context.Background()
      for scanner.Scan() {
          itemID := scanner.Text()
          category := api.SearchAPI.FindCategory(itemID, lang, ctx)
          _, _ = fmt.Fprintf(resp, "%v,%v \n", itemID, category)
          count++
      }
  
      if err := scanner.Err(); err != nil {
          logger.Errorf("scan file error: %v", err)
          http.Error(resp, err.Error(), http.StatusBadRequest)
          return
      }
  
     //.....
  }
  </code></pre>