Created
April 24, 2018 19:07
-
-
Save yehohanan7/dbfb59eedee429dfb21a11f79a554445 to your computer and use it in GitHub Desktop.
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 ( | |
"bytes" | |
"fmt" | |
"net" | |
"net/http" | |
"net/http/httputil" | |
"strconv" | |
) | |
func main() { | |
tcpConn, _ := net.Dial("tcp", "127.0.0.1:4000") | |
conn := httputil.NewClientConn(tcpConn, nil) | |
for i := 0; i < 10; i++ { | |
req, _ := http.NewRequest("POST", "/candidates", bytes.NewBuffer([]byte(fmt.Sprintf(`{ "id": "%v"}`, "id"+strconv.Itoa(i))))) | |
req.Header.Set("Content-Type", "application/json") | |
resp, err := conn.Do(req) | |
if err != nil { | |
panic(err) | |
} | |
fmt.Println(resp) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment