Esempio n. 1
0
func newNetworkClient(config Config) network.Client {
	return network.NewClient(network.Config{
		Host:          config.Host,
		SkipVerifySSL: config.SkipVerifySSL,
		TraceWriter:   config.TraceWriter,
	})
}
Esempio n. 2
0
		fakeServer = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
			if req.Body != nil {
				body, err := ioutil.ReadAll(req.Body)
				if err != nil {
					panic(err)
				}

				receivedRequest.Body = string(body)
			}

			receivedRequest.Header = req.Header
		}))

		client = network.NewClient(network.Config{
			Host:          fakeServer.URL,
			SkipVerifySSL: true,
			TraceWriter:   TraceWriter,
		})
	})

	AfterEach(func() {
		fakeServer.Close()
	})

	Describe("makeRequest", func() {
		It("can make requests", func() {
			jsonBody := map[string]interface{}{
				"hello": "goodbye",
			}

			_, err := client.MakeRequest(network.Request{