java-express icon indicating copy to clipboard operation
java-express copied to clipboard

testability - expose access to InetSocketAddress of HttpServer

Open szczebel opened this issue 4 years ago • 2 comments

When running tests on CI/CD, I need to start the application under test on random port with Express.listen(0). Then I'd like to obtain the actual port number to hand it over to RestAssured (or whatever other rest client)

Proposed addition to express.Express class:

public InetSocketAddress getAddress() {
    return httpServer.getAddress(); 
}

szczebel avatar Dec 10 '20 23:12 szczebel

This has been addressed in my fork of this project if you want to check it out. https://github.com/masecla22/java-express

You can access it through

Express.getHttpServer().getAddress();

masecla22 avatar Sep 11 '21 13:09 masecla22

This has been addressed in my fork of this project if you want to check it out. https://github.com/masecla22/java-express

You can access it through

Express.getHttpServer().getAddress();

@masecla22 , I see the Express.getHttpServer() on your master, but it seems unpublished - this method is not existing in com.github.masecla22:java-express:0.2.2. Would you mind publishing?

szczebel avatar Sep 22 '21 16:09 szczebel