Skip to content

Commit 8e11556

Browse files
committed
resolve: extract InstanceHandler.forSession into a variable
- 'Please extract this to a variable instead of calling forSession twice.'
1 parent a77fad7 commit 8e11556

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

api/src/main/java/xyz/gianlu/librespot/api/ApiServer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public class ApiServer {
3535
private Undertow undertow = null;
3636

3737
public ApiServer(int port, @NotNull String host, @NotNull SessionWrapper wrapper) {
38+
AbsSessionHandler instanceHandler = InstanceHandler.forSession(this, wrapper);
39+
3840
this.port = port;
3941
this.host = host;
4042
this.wrapper = wrapper;
@@ -45,8 +47,8 @@ public ApiServer(int port, @NotNull String host, @NotNull SessionWrapper wrapper
4547
.post("/token/{scope}", new TokensHandler(wrapper))
4648
.post("/profile/{user_id}/{action}", new ProfileHandler(wrapper))
4749
.post("/web-api/{endpoint}", new WebApiHandler(wrapper))
48-
.get("/instance", InstanceHandler.forSession(this, wrapper))
49-
.post("/instance/{action}", InstanceHandler.forSession(this, wrapper))
50+
.get("/instance", instanceHandler)
51+
.post("/instance/{action}", instanceHandler)
5052
.post("/discovery/{action}", new DiscoveryHandler())
5153
.get("/events", events)
5254
.setFallbackHandler(new PathHandler(ResponseCodeHandler.HANDLE_404)

0 commit comments

Comments
 (0)