public void should_add_custom_headers_to_connection_if_present() { string unleashAPI = "http://unleash.org"; string headerName = "UNLEASH-CUSTOM-TEST-HEADER"; string headerValue = "Some value"; UnleashConfig unleashConfig = UnleashConfig.TheBuilder() .AppName("my-app") .InstanceId("my-instance-1") .UnleashAPI(unleashAPI) .CustomHttpHeader(headerName, headerValue) .Build(); var someUrl = new Uri(unleashAPI + "/some/arbitrary/path"); var request = new HttpRequestMessage(HttpMethod.Get, someUrl); UnleashConfig.SetRequestProperties(request.Headers, unleashConfig); Assert.Single(request.Headers.GetValues(headerName)); Assert.Equal(headerValue, request.Headers.GetValues(headerName).First()); }
public void should_require_unleasAPI_url() { Assert.Throws <ArgumentNullException>(() => UnleashConfig.TheBuilder().AppName("test").Build()); }