use of com.github.dreamhead.moco.HttpServer in project moco by dreamhead.
the class ActualHttpServerTest method should_config_handler_correctly_while_merging.
@Test
public void should_config_handler_correctly_while_merging() throws Exception {
httpServer = httpServer(12306, fileRoot("src/test/resources"));
httpServer.response(file("foo.response"));
HttpServer mergedServer = ((ActualHttpServer) anotherServer).mergeServer((ActualHttpServer) httpServer);
running(mergedServer, () -> assertThat(helper.get(root()), is("foo.response")));
}
use of com.github.dreamhead.moco.HttpServer in project moco by dreamhead.
the class JsonRunner method createHttpServer.
private HttpServer createHttpServer(final Iterable<? extends RunnerSetting> settings, final StartArgs startArgs) {
HttpServer targetServer = createBaseHttpServer(settings, startArgs);
targetServer.request(by(uri("/favicon.ico"))).response(with(pathResource("favicon.png")), with(header(HttpHeaders.CONTENT_TYPE, MediaType.PNG.toString())));
return targetServer;
}
Aggregations