greenhost image links: {}
This commit is contained in:
parent
45ddb4ae9f
commit
0646c0fc9d
|
@ -73,7 +73,7 @@ type imageRoot struct {
|
|||
|
||||
type imagesRoot struct {
|
||||
Images []Image
|
||||
Links []*LinkAction `json:"links"`
|
||||
Links *Links `json:"links"`
|
||||
Meta *Meta `json:"meta"`
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,11 @@ func (s *ImagesServiceOp) list(ctx context.Context, opt *ListOptions, listOpt *l
|
|||
return nil, resp, err
|
||||
}
|
||||
if l := root.Links; l != nil {
|
||||
resp.Links = l
|
||||
var wrappedActions []*LinkAction
|
||||
for _, element := range (*l).Actions {
|
||||
wrappedActions = append(wrappedActions, &element)
|
||||
}
|
||||
resp.Links = wrappedActions
|
||||
}
|
||||
if m := root.Meta; m != nil {
|
||||
resp.Meta = m
|
||||
|
|
|
@ -221,7 +221,7 @@ func TestImages_ListImagesMultiplePages(t *testing.T) {
|
|||
|
||||
mux.HandleFunc("/v2/images", func(w http.ResponseWriter, r *http.Request) {
|
||||
testMethod(t, r, http.MethodGet)
|
||||
fmt.Fprint(w, `{"images": [{"id": "1"},{"id": "2"}], "links":[]}`)
|
||||
fmt.Fprint(w, `{"images": [{"id": "1"},{"id": "2"}], "links":{}}`)
|
||||
})
|
||||
|
||||
_, _, err := client.Images.List(ctx, &ListOptions{Page: 2})
|
||||
|
@ -237,7 +237,7 @@ func TestImages_RetrievePageByNumber(t *testing.T) {
|
|||
jBlob := `
|
||||
{
|
||||
"images": [{"id": "1"},{"id": "2"}],
|
||||
"links":[]
|
||||
"links":{}
|
||||
}`
|
||||
|
||||
mux.HandleFunc("/v2/images", func(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
Loading…
Reference in New Issue