From 7fdacb9163bb9fe673c80f4c399e55eb55962672 Mon Sep 17 00:00:00 2001 From: Avraham Shalev <8184528+avrahams@users.noreply.github.com> Date: Sun, 26 Feb 2023 19:52:06 +0200 Subject: [PATCH] Add get port --- server/server.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/server/server.go b/server/server.go index 47928d4..9837c8a 100644 --- a/server/server.go +++ b/server/server.go @@ -17,6 +17,10 @@ const localHost = "127.0.0.1" type TestServer interface { //get server URL and port GetURL() string + //get server port + GetPort() int + //get server port as string + GetPortAsString() string //get the current number of requests received by the server GetRequestCount() int //SetOption sets a new option to the server, error is return if the option cannot be modified @@ -60,6 +64,14 @@ func (ts *mockTestingServer) GetURL() string { return fmt.Sprintf("http://%s:%d", localHost, ts.options.port) } +func (ts *mockTestingServer) GetPort() int { + return ts.options.port +} + +func (ts *mockTestingServer) GetPortAsString() string { + return fmt.Sprintf("%d", ts.options.port) +} + func (ts *mockTestingServer) SetOption(opt ServerOption) error { ts.mux.Lock() defer ts.mux.Unlock()