encodePlatform marshals the given platform to JSON format, to be used for query-parameters for filtering / selecting platforms. It is used as a helper for encodePlatforms,
(platform *ocispec.Platform)
| 107 | // be used for query-parameters for filtering / selecting platforms. It |
| 108 | // is used as a helper for encodePlatforms, |
| 109 | func encodePlatform(platform *ocispec.Platform) (string, error) { |
| 110 | p, err := json.Marshal(platform) |
| 111 | if err != nil { |
| 112 | return "", fmt.Errorf("%w: invalid platform: %v", cerrdefs.ErrInvalidArgument, err) |
| 113 | } |
| 114 | return string(p), nil |
| 115 | } |
| 116 | |
| 117 | func decodeWithRaw[T any](resp *http.Response, out *T) (raw json.RawMessage, _ error) { |
| 118 | if resp == nil || resp.Body == nil { |
searching dependent graphs…