Created
June 6, 2023 17:36
-
-
Save raullenchai/d0e9792120d5c32540adb9b723b619b1 to your computer and use it in GitHub Desktop.
My W3bstream Demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"strings" | |
"net/http" | |
"io/ioutil" | |
"time" | |
) | |
func main() { | |
url := "https://devnet-prod-api.w3bstream.com/srv-applet-mgr/v0/event/eth_0x8a20211766dd34fb96ab82fff59622cf44e24e1e_demo1" | |
method := "POST" | |
payload := strings.NewReader("123123") | |
client := &http.Client {} | |
for i := 0; i < 100; i++ { | |
req, err := http.NewRequest(method, url, payload) | |
req.Header.Add("Authorization", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJQYXlsb2FkIjoiOTAyODA5MDQ3MDk1MTk0MyIsImlzcyI6InczYnN0cmVhbSJ9.vgLI49ijs81RgweJz7dBj3LZEpTP6VGXgjy0a5-NnKo") | |
req.Header.Add("Content-Type", "application/octet-stream") | |
if err != nil { | |
fmt.Println(err) | |
return | |
} | |
res, err := client.Do(req) | |
if err != nil { | |
fmt.Println(err) | |
return | |
} | |
defer res.Body.Close() | |
body, err := ioutil.ReadAll(res.Body) | |
if err != nil { | |
fmt.Println(err) | |
return | |
} | |
fmt.Println(string(body)) | |
//Sleep for 1 second | |
time.Sleep(1 * time.Second) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment