@Test public void lookup_passes_x_forwarded_for() { restClient .request() .addHeader(HttpHeaders.X_FORWARDED_FOR, "10.20.30.40") .lookup(ObjectType.MNTNER, OWNER_MNT.getKey().toString()); assertThat(queryLog.getMessages(), hasSize(1)); assertThat(queryLog.getMessage(0), containsString(" PW-API-INFO <0+1+0> ")); assertThat(queryLog.getMessage(0), containsString("ms [10.20.30.40] -- ")); }
@Test public void search_passes_x_forwarded_for() { final Collection<RpslObject> objects = restClient .request() .addHeader(HttpHeaders.X_FORWARDED_FOR, "10.20.30.40") .addParam("query-string", "OWNER-MNT") .addParam("type-filter", "mntner") .addParam("flags", "B") .search(); assertThat(objects, hasSize(2)); assertThat(queryLog.getMessages().size(), is(1)); assertThat(queryLog.getMessage(0), containsString(" PW-API-INFO <1+1+0> ")); assertThat(queryLog.getMessage(0), containsString("ms [10.20.30.40] -- ")); }
@Test public void streaming_search_passes_on_x_forwarded_for() { final Iterator<WhoisObject> objects = restClient .request() .addHeader(HttpHeaders.X_FORWARDED_FOR, "10.20.30.40") .addParam("query-string", "OWNER-MNT") .addParam("type-filter", "mntner") .addParam("flags", "B") .streamingSearch(); final List<WhoisObject> whoisObjects = Lists.newArrayList(objects); assertThat(whoisObjects, hasSize(2)); assertThat(queryLog.getMessages().size(), is(1)); assertThat(queryLog.getMessage(0), containsString(" PW-API-INFO <1+1+0> ")); assertThat(queryLog.getMessage(0), containsString("ms [10.20.30.40] -- ")); }