Skip to content

Commit

Permalink
Log errors when closing a GET response body reader
Browse files Browse the repository at this point in the history
  • Loading branch information
the-c0d3br34k3r committed Jul 29, 2024
1 parent 99fbbc3 commit bbff75f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Binary file modified script/main.wasm
Binary file not shown.
4 changes: 2 additions & 2 deletions wasm_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ func getResponse[T interface{}](url string, responseStruct *T) ([]byte, error) {
if err != nil {
return nil, err
}
response.Body.Close()
if responseStruct != nil {
err = response.Body.Close()
if err == nil && responseStruct != nil {
contentType := response.Header.Get("Content-Type")
fmt.Println("Content-Type = ", contentType)
if contentType == "application/json" {
Expand Down

0 comments on commit bbff75f

Please sign in to comment.