Skip to content

Commit

Permalink
Merge pull request #26 from iluxa/fix/outbound-tls-golang_client_reading
Browse files Browse the repository at this point in the history
fix outbound-tls-golang client reading
  • Loading branch information
alongir authored Feb 7, 2024
2 parents 081f71f + 5dff0ae commit 6484b7d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
Binary file modified additions/outbound-tls-golang/main
Binary file not shown.
32 changes: 26 additions & 6 deletions additions/outbound-tls-golang/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,13 @@ func main() {
fmt.Println(err)
continue
}
defer res.Body.Close()
_, err = io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
continue
}
fmt.Printf("res: %+v\n", res)
res.Body.Close()

payload := strings.NewReader(fmt.Sprintf("------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"email\"\r\n\r\njohn.doe.%[email protected]\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nJohn\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"gender\"\r\n\r\nmale\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"status\"\r\n\r\nactive\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--", j))
req, err = http.NewRequest("POST", "https://gorest.co.in/public/v2/users", payload)
Expand All @@ -59,8 +64,13 @@ func main() {
fmt.Println(err)
continue
}
defer res.Body.Close()
_, err = io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
continue
}
fmt.Printf("res: %+v\n", res)
res.Body.Close()

req, err = http.NewRequest("GET", "https://gorest.co.in/public/v2/users", nil)
if err != nil {
Expand All @@ -74,8 +84,13 @@ func main() {
fmt.Println(err)
continue
}
defer res.Body.Close()
_, err = io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
continue
}
fmt.Printf("res: %+v\n", res)
res.Body.Close()

req, err = http.NewRequest("GET", "https://gorest.co.in/public/v2/posts", nil)
if err != nil {
Expand All @@ -89,13 +104,18 @@ func main() {
fmt.Println(err)
continue
}
defer res.Body.Close()
fmt.Printf("res: %+v\n", res)
_, err = io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
continue
}
_, err = io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
}
fmt.Printf("res: %+v\n", res)
res.Body.Close()

time.Sleep(3 * time.Second)
}
}
}

0 comments on commit 6484b7d

Please sign in to comment.