mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Use Swagger#UnmarshalJSON rather than json.Unmarshal
Since we're now using the experimental json code to deserialize spec.Swagger, we should rather use UnmarshalJSON since this has a much lower CPU overhead.
This commit is contained in:
parent
449c46258b
commit
5be7430fe3
@ -22,7 +22,6 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
utiljson "k8s.io/apimachinery/pkg/util/json"
|
||||
"k8s.io/apiserver/pkg/authentication/user"
|
||||
"k8s.io/apiserver/pkg/endpoints/request"
|
||||
"k8s.io/kube-openapi/pkg/validation/spec"
|
||||
@ -79,7 +78,7 @@ func (s *Downloader) Download(handler http.Handler, etag string) (returnSpec *sp
|
||||
return nil, "", http.StatusNotFound, nil
|
||||
case http.StatusOK:
|
||||
openAPISpec := &spec.Swagger{}
|
||||
if err := utiljson.Unmarshal(writer.data, openAPISpec); err != nil {
|
||||
if err := openAPISpec.UnmarshalJSON(writer.data); err != nil {
|
||||
return nil, "", 0, err
|
||||
}
|
||||
newEtag = writer.Header().Get("Etag")
|
||||
|
Loading…
Reference in New Issue
Block a user