aboutsummaryrefslogtreecommitdiff
path: root/lib/http/server.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-03-08 02:52:16 +0700
committerShulhan <ms@kilabit.info>2024-03-09 01:10:24 +0700
commit29343294a596fd74f6f9cb917c8aac74ccb78094 (patch)
treee9286ed53041b973cb6d767325034f30e504e1f5 /lib/http/server.go
parent4e35c509a41cecb207bf6f52e7c9a529fa9f71fb (diff)
downloadpakakeh.go-29343294a596fd74f6f9cb917c8aac74ccb78094.tar.xz
lib/http: refactoring NewServer and NewClient
The NewServer and NewClient now accept non-pointer options, so the caller unable to modify the options once the server or client has been created.
Diffstat (limited to 'lib/http/server.go')
-rw-r--r--lib/http/server.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/http/server.go b/lib/http/server.go
index d2e69ecc..b47ddba3 100644
--- a/lib/http/server.go
+++ b/lib/http/server.go
@@ -33,24 +33,24 @@ const (
type Server struct {
*http.Server
- // Options for server, set by calling NewServer.
- // This field is exported only for reference, for example logging in
- // the Options when server started.
- // Modifying the value of Options after server has been started may
- // cause undefined effects.
- Options *ServerOptions
-
evals []Evaluator
routeDeletes []*route
routeGets []*route
routePatches []*route
routePosts []*route
routePuts []*route
+
+ // Options for server, set by calling NewServer.
+ // This field is exported only for reference, for example logging in
+ // the Options when server started.
+ // Modifying the value of Options after server has been started may
+ // cause undefined effects.
+ Options ServerOptions
}
// NewServer create and initialize new HTTP server that serve root directory
// with custom connection.
-func NewServer(opts *ServerOptions) (srv *Server, err error) {
+func NewServer(opts ServerOptions) (srv *Server, err error) {
opts.init()
srv = &Server{