if req.URL.Path == "/health_check" && req.Method == "POST" {
					buf, err := ioutil.ReadAll(req.Body)
					Expect(err).NotTo(HaveOccurred())
					if string(buf) == "false" {
						wasCalled = true
						w.WriteHeader(http.StatusOK)
						return
					}

					w.WriteHeader(http.StatusInternalServerError)
				}

				w.WriteHeader(http.StatusTeapot)
			}))

			tcClient := client.New(server.URL)

			err := tcClient.SetHealthCheck(false)
			Expect(err).NotTo(HaveOccurred())

			Expect(wasCalled).To(BeTrue())
		})

		Context("failure cases", func() {
			It("returns an error when the url is malformed", func() {
				tcClient := client.New("%%%%%%")

				err := tcClient.SetHealthCheck(true)
				Expect(err).To(MatchError(ContainSubstring("invalid URL escape")))
			})
var _ = Describe("given large DNS response", func() {
	var (
		consulManifest     consul.ManifestV2
		testConsumerClient testconsumerclient.Client
		err                error
	)
	BeforeEach(func() {
		consulManifest, _, err = helpers.DeployConsulWithFakeDNSServer("large-dns-response", 1, boshClient, config)
		Expect(err).NotTo(HaveOccurred())

		Eventually(func() ([]bosh.VM, error) {
			return helpers.DeploymentVMs(boshClient, consulManifest.Name)
		}, "1m", "10s").Should(ConsistOf(helpers.GetVMsFromManifest(consulManifest)))

		testConsumerClient = testconsumerclient.New(fmt.Sprintf("http://%s:6769", consulManifest.InstanceGroups[1].Networks[0].StaticIPs[0]))
	})

	AfterEach(func() {
		By("deleting consul deployment", func() {
			if !CurrentGinkgoTestDescription().Failed {
				Eventually(func() ([]string, error) {
					return lockedDeployments()
				}, "10m", "30s").ShouldNot(ContainElement(consulManifest.Name))

				err := boshClient.DeleteDeployment(consulManifest.Name)
				Expect(err).NotTo(HaveOccurred())
			}
		})
	})