Skip to content

Commit

Permalink
Fix fetch so that we don't error when no body
Browse files Browse the repository at this point in the history
Sometimes the response will not contain a body. When this happens an
error is returned from chrome. We should ignore the error and return
nil.
  • Loading branch information
ankur22 committed Jan 28, 2025
1 parent 11ae2a1 commit 3dd1239
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/js/modules/k6/browser/common/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,9 @@ func (r *Response) fetchBody() error {
}
action := network.GetResponseBody(r.request.requestID)
body, err := action.Do(cdp.WithExecutor(r.ctx, r.request.frame.manager.session))
if err != nil && strings.Contains(err.Error(), "No data found for resource with given identifier") {
return nil
}
if err != nil {
return fmt.Errorf("fetching response body: %w", err)
}
Expand Down

0 comments on commit 3dd1239

Please sign in to comment.