Move one-time svg mime init code into Run()

This commit is contained in:
Dr. Stefan Schimanski
2016-09-26 11:21:18 +02:00
parent b48ac54e1c
commit e2c17d69f7
2 changed files with 8 additions and 6 deletions

View File

@@ -20,7 +20,6 @@ import (
"crypto/tls"
"fmt"
"io"
"mime"
"net"
"net/http"
"os"
@@ -338,11 +337,6 @@ func (c Config) New() (*GenericAPIServer, error) {
})
}
// Send correct mime type for .svg files.
// TODO: remove when https://github.com/golang/go/commit/21e47d831bafb59f22b1ea8098f709677ec8ce33
// makes it into all of our supported go versions (only in v1.7.1 now).
mime.AddExtensionType(".svg", "image/svg+xml")
apiserver.InstallServiceErrorHandler(s.Serializer, s.HandlerContainer)
s.installAPI(&c)

View File

@@ -19,6 +19,7 @@ package genericapiserver
import (
"crypto/tls"
"fmt"
"mime"
"net"
"net/http"
"path"
@@ -167,6 +168,13 @@ type GenericAPIServer struct {
postStartHooksCalled bool
}
func init() {
// Send correct mime type for .svg files.
// TODO: remove when https://github.com/golang/go/commit/21e47d831bafb59f22b1ea8098f709677ec8ce33
// makes it into all of our supported go versions (only in v1.7.1 now).
mime.AddExtensionType(".svg", "image/svg+xml")
}
// RequestContextMapper is exposed so that third party resource storage can be build in a different location.
// TODO refactor third party resource storage
func (s *GenericAPIServer) RequestContextMapper() api.RequestContextMapper {