Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
7e33b128
Unverified
Commit
7e33b128
authored
Jan 14, 2018
by
Jordan Liggitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return the correct set of supported mime types for non-streaming requests
parent
5911f87d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
18 deletions
+17
-18
create.go
...ing/src/k8s.io/apiserver/pkg/endpoints/handlers/create.go
+1
-1
delete.go
...ing/src/k8s.io/apiserver/pkg/endpoints/handlers/delete.go
+2
-2
negotiate.go
...apiserver/pkg/endpoints/handlers/negotiation/negotiate.go
+13
-14
update.go
...ing/src/k8s.io/apiserver/pkg/endpoints/handlers/update.go
+1
-1
No files found.
staging/src/k8s.io/apiserver/pkg/endpoints/handlers/create.go
View file @
7e33b128
...
@@ -61,7 +61,7 @@ func createHandler(r rest.NamedCreater, scope RequestScope, typer runtime.Object
...
@@ -61,7 +61,7 @@ func createHandler(r rest.NamedCreater, scope RequestScope, typer runtime.Object
ctx
=
request
.
WithNamespace
(
ctx
,
namespace
)
ctx
=
request
.
WithNamespace
(
ctx
,
namespace
)
gv
:=
scope
.
Kind
.
GroupVersion
()
gv
:=
scope
.
Kind
.
GroupVersion
()
s
,
err
:=
negotiation
.
NegotiateInputSerializer
(
req
,
scope
.
Serializer
)
s
,
err
:=
negotiation
.
NegotiateInputSerializer
(
req
,
false
,
scope
.
Serializer
)
if
err
!=
nil
{
if
err
!=
nil
{
scope
.
err
(
err
,
w
,
req
)
scope
.
err
(
err
,
w
,
req
)
return
return
...
...
staging/src/k8s.io/apiserver/pkg/endpoints/handlers/delete.go
View file @
7e33b128
...
@@ -60,7 +60,7 @@ func DeleteResource(r rest.GracefulDeleter, allowsOptions bool, scope RequestSco
...
@@ -60,7 +60,7 @@ func DeleteResource(r rest.GracefulDeleter, allowsOptions bool, scope RequestSco
return
return
}
}
if
len
(
body
)
>
0
{
if
len
(
body
)
>
0
{
s
,
err
:=
negotiation
.
NegotiateInputSerializer
(
req
,
metainternalversion
.
Codecs
)
s
,
err
:=
negotiation
.
NegotiateInputSerializer
(
req
,
false
,
metainternalversion
.
Codecs
)
if
err
!=
nil
{
if
err
!=
nil
{
scope
.
err
(
err
,
w
,
req
)
scope
.
err
(
err
,
w
,
req
)
return
return
...
@@ -228,7 +228,7 @@ func DeleteCollection(r rest.CollectionDeleter, checkBody bool, scope RequestSco
...
@@ -228,7 +228,7 @@ func DeleteCollection(r rest.CollectionDeleter, checkBody bool, scope RequestSco
return
return
}
}
if
len
(
body
)
>
0
{
if
len
(
body
)
>
0
{
s
,
err
:=
negotiation
.
NegotiateInputSerializer
(
req
,
scope
.
Serializer
)
s
,
err
:=
negotiation
.
NegotiateInputSerializer
(
req
,
false
,
scope
.
Serializer
)
if
err
!=
nil
{
if
err
!=
nil
{
scope
.
err
(
err
,
w
,
req
)
scope
.
err
(
err
,
w
,
req
)
return
return
...
...
staging/src/k8s.io/apiserver/pkg/endpoints/handlers/negotiation/negotiate.go
View file @
7e33b128
...
@@ -73,31 +73,30 @@ func NegotiateOutputStreamSerializer(req *http.Request, ns runtime.NegotiatedSer
...
@@ -73,31 +73,30 @@ func NegotiateOutputStreamSerializer(req *http.Request, ns runtime.NegotiatedSer
}
}
// NegotiateInputSerializer returns the input serializer for the provided request.
// NegotiateInputSerializer returns the input serializer for the provided request.
func
NegotiateInputSerializer
(
req
*
http
.
Request
,
ns
runtime
.
NegotiatedSerializer
)
(
runtime
.
SerializerInfo
,
error
)
{
func
NegotiateInputSerializer
(
req
*
http
.
Request
,
streaming
bool
,
ns
runtime
.
NegotiatedSerializer
)
(
runtime
.
SerializerInfo
,
error
)
{
mediaType
:=
req
.
Header
.
Get
(
"Content-Type"
)
mediaType
:=
req
.
Header
.
Get
(
"Content-Type"
)
return
NegotiateInputSerializerForMediaType
(
mediaType
,
ns
)
return
NegotiateInputSerializerForMediaType
(
mediaType
,
streaming
,
ns
)
}
}
// NegotiateInputSerializerForMediaType returns the appropriate serializer for the given media type or an error.
// NegotiateInputSerializerForMediaType returns the appropriate serializer for the given media type or an error.
func
NegotiateInputSerializerForMediaType
(
mediaType
string
,
ns
runtime
.
NegotiatedSerializer
)
(
runtime
.
SerializerInfo
,
error
)
{
func
NegotiateInputSerializerForMediaType
(
mediaType
string
,
streaming
bool
,
ns
runtime
.
NegotiatedSerializer
)
(
runtime
.
SerializerInfo
,
error
)
{
mediaTypes
:=
ns
.
SupportedMediaTypes
()
mediaTypes
:=
ns
.
SupportedMediaTypes
()
if
len
(
mediaType
)
==
0
{
if
len
(
mediaType
)
==
0
{
mediaType
=
mediaTypes
[
0
]
.
MediaType
mediaType
=
mediaTypes
[
0
]
.
MediaType
}
}
mediaType
,
_
,
err
:=
mime
.
ParseMediaType
(
mediaType
)
if
mediaType
,
_
,
err
:=
mime
.
ParseMediaType
(
mediaType
);
err
==
nil
{
if
err
!=
nil
{
for
_
,
info
:=
range
mediaTypes
{
_
,
supported
:=
MediaTypesForSerializer
(
ns
)
if
info
.
MediaType
!=
mediaType
{
return
runtime
.
SerializerInfo
{},
NewUnsupportedMediaTypeError
(
supported
)
continue
}
}
return
info
,
nil
for
_
,
info
:=
range
mediaTypes
{
if
info
.
MediaType
!=
mediaType
{
continue
}
}
return
info
,
nil
}
}
_
,
supported
:=
MediaTypesForSerializer
(
ns
)
supported
,
streamingSupported
:=
MediaTypesForSerializer
(
ns
)
if
streaming
{
return
runtime
.
SerializerInfo
{},
NewUnsupportedMediaTypeError
(
streamingSupported
)
}
return
runtime
.
SerializerInfo
{},
NewUnsupportedMediaTypeError
(
supported
)
return
runtime
.
SerializerInfo
{},
NewUnsupportedMediaTypeError
(
supported
)
}
}
...
...
staging/src/k8s.io/apiserver/pkg/endpoints/handlers/update.go
View file @
7e33b128
...
@@ -56,7 +56,7 @@ func UpdateResource(r rest.Updater, scope RequestScope, typer runtime.ObjectType
...
@@ -56,7 +56,7 @@ func UpdateResource(r rest.Updater, scope RequestScope, typer runtime.ObjectType
return
return
}
}
s
,
err
:=
negotiation
.
NegotiateInputSerializer
(
req
,
scope
.
Serializer
)
s
,
err
:=
negotiation
.
NegotiateInputSerializer
(
req
,
false
,
scope
.
Serializer
)
if
err
!=
nil
{
if
err
!=
nil
{
scope
.
err
(
err
,
w
,
req
)
scope
.
err
(
err
,
w
,
req
)
return
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment