@Test public void test_no_header() { Registration registration = Registration.create("foo", "http: Instance instance = Instance.create(InstanceId.of("id")).register(registration); assertThat(headersProvider.getHeaders(instance)).isEmpty(); }
@Override public HttpHeaders getHeaders(Instance instance) { String username = instance.getRegistration().getMetadata().get("user.name"); String password = instance.getRegistration().getMetadata().get("user.password"); HttpHeaders headers = new HttpHeaders(); if (StringUtils.hasText(username) && StringUtils.hasText(password)) { headers.set(HttpHeaders.AUTHORIZATION, encode(username, password)); } return headers; }
BasicAuthHttpHeaderProvider implements HttpHeadersProvider { @Override public HttpHeaders getHeaders(Instance instance) { String username = instance.getRegistration().getMetadata().get("user.name"); String password = instance.getRegistration().getMetadata().get("user.password"); HttpHeaders headers = new HttpHeaders(); if (StringUtils.hasText(username) && StringUtils.hasText(password)) { headers.set(HttpHeaders.AUTHORIZATION, encode(username, password)); } return headers; } }
BasicAuthHttpHeaderProvider implements HttpHeadersProvider { @Override public HttpHeaders getHeaders(Instance instance) { String username = instance.getRegistration().getMetadata().get("user.name"); String password = instance.getRegistration().getMetadata().get("user.password"); HttpHeaders headers = new HttpHeaders(); if (StringUtils.hasText(username) && StringUtils.hasText(password)) { headers.set(HttpHeaders.AUTHORIZATION, encode(username, password)); } return headers; }  }
BasicAuthHttpHeaderProvider implements HttpHeadersProvider { @Override public HttpHeaders getHeaders(Instance instance) { String username = instance.getRegistration().getMetadata().get("user.name"); String password = instance.getRegistration().getMetadata().get("user.password"); HttpHeaders headers = new HttpHeaders(); if (StringUtils.hasText(username) && StringUtils.hasText(password)) { headers.set(HttpHeaders.AUTHORIZATION, encode(username, password)); } return headers; }  @Override HttpHeaders getHeaders(Instance instance); }
BasicAuthHttpHeaderProvider implements HttpHeadersProvider { @Override public HttpHeaders getHeaders(Instance instance) { String username = instance.getRegistration().getMetadata().get("user.name"); String password = instance.getRegistration().getMetadata().get("user.password"); HttpHeaders headers = new HttpHeaders(); if (StringUtils.hasText(username) && StringUtils.hasText(password)) { headers.set(HttpHeaders.AUTHORIZATION, encode(username, password)); } return headers; }  @Override HttpHeaders getHeaders(Instance instance);  }