MCPcopy Create free account
hub / github.com/aptly-dev/aptly / NewServer

Function NewServer

s3/server_test.go:104–121  ·  view source on GitHub ↗
(config *Config)

Source from the content-addressed store, hash-verified

102}
103
104func NewServer(config *Config) (*Server, error) {
105 l, err := net.Listen("tcp", "localhost:0")
106 if err != nil {
107 return nil, fmt.Errorf("cannot listen on localhost: %v", err)
108 }
109 srv := &Server{
110 listener: l,
111 url: "http://" + l.Addr().String(),
112 buckets: make(map[string]*bucket),
113 config: config,
114 }
115 go func() {
116 _ = http.Serve(l, http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
117 srv.serveHTTP(w, req)
118 }))
119 }()
120 return srv, nil
121}
122
123// Quit closes down the server.
124func (srv *Server) Quit() {

Callers 1

SetUpTestMethod · 0.85

Calls 2

serveHTTPMethod · 0.95
StringMethod · 0.65

Tested by

no test coverage detected