Decouple apiserver from codec implementation
The apiserver on initialization must be provided with a codec for encoding and decoding all handled objects including api.Status and api.ServerOp. In addition, the RESTStorage Extract() method has been changed to New(), which returns a pointer object that the codec must decode into (the internal object). Switched registry methods to use pointers for Create/Update instead of values.
This commit is contained in:
@@ -42,7 +42,7 @@ func TestWatchWebsocket(t *testing.T) {
|
||||
simpleStorage := &SimpleRESTStorage{}
|
||||
handler := New(map[string]RESTStorage{
|
||||
"foo": simpleStorage,
|
||||
}, "/prefix/version")
|
||||
}, codec, "/prefix/version")
|
||||
server := httptest.NewServer(handler)
|
||||
|
||||
dest, _ := url.Parse(server.URL)
|
||||
@@ -92,7 +92,7 @@ func TestWatchHTTP(t *testing.T) {
|
||||
simpleStorage := &SimpleRESTStorage{}
|
||||
handler := New(map[string]RESTStorage{
|
||||
"foo": simpleStorage,
|
||||
}, "/prefix/version")
|
||||
}, codec, "/prefix/version")
|
||||
server := httptest.NewServer(handler)
|
||||
client := http.Client{}
|
||||
|
||||
|
Reference in New Issue
Block a user