func (c *HTTPRESTClient) Get(ctx context.Context, path path.Path, result interface{}) (RESTResponse, error) {
	req, err := http.NewRequestWithContext(ctx, "GET", path.String(), nil)
	if err != nil {
		return RESTResponse{}, errors.Annotate(err, "can not make new request")
	}

	// Compose the request headers.
	headers := make(http.Header)
	headers.Set("Accept", JSON)
	headers.Set("Content-Type", JSON)

	req.Header = c.composeHeaders(headers)

	resp, err := c.transport.Do(req)
	if err != nil {
		return RESTResponse{}, errors.Trace(err)
	}
	defer func() { _ = resp.Body.Close() }()

	// Parse the response.
	if err := httprequest.UnmarshalJSONResponse(resp, result); err != nil {
		return RESTResponse{}, errors.Annotate(err, "charm hub client get")
	}

	return RESTResponse{
		StatusCode: resp.StatusCode,
	}, nil
}
// Get makes a GET request to the given path in the CharmHub (not
// including the host name or version prefix but including a leading /),
// parsing the result as JSON into the given result value, which should
// be a pointer to the expected data, but may be nil if no result is
// desired.
Get makes a GET request to the given path in the CharmHub (not
including the host name or version prefix but including a leading /),
parsing the result as JSON into the given result value, which should
be a pointer to the expected data, but may be nil if no result is
desired.
// Get makes a GET request to the given path in the CharmHub ( not // including the host name or version prefix but including a leading / ) // parsing the result as JSON into the given result value which should // be a pointer to the expected data but may be nil if no result is // desired .
func (c *HTTPRESTClient) Get(ctx context.Context, path path.Path, result interface{}) (RESTResponse, error) {
	req, err := http.NewRequestWithContext(ctx, "GET", path.String(), nil)
	if err != nil {
		return RESTResponse{}, errors.Annotate(err, "can not make new request")
	}
	headers := make(http.Header)
	headers.Set("Accept", JSON)
	headers.Set("Content-Type", JSON)
	req.Header = c.composeHeaders(headers)
	resp, err := c.transport.Do(req)
	if err != nil {
		return RESTResponse{}, errors.Trace(err)
	}
	defer func() { _ = resp.Body.Close() }()
	if err := httprequest.UnmarshalJSONResponse(resp, result); err != nil {
		return RESTResponse{}, errors.Annotate(err, "charm hub client get")
	}
	return RESTResponse{
		StatusCode: resp.StatusCode,
	}, nil
}
func ( c * HTTPRESTClient ) Get ( ctx context . Context , path path . Path , result interface { } ) ( RESTResponse , error ) { req , err := http . NewRequestWithContext ( ctx , " " , path . String ( ) , nil ) if err != nil { return RESTResponse { } , errors . Annotate ( err , " " ) } headers := make ( http . Header ) headers . Set ( " " , JSON ) headers . Set ( " " , JSON ) req . Header = c . composeHeaders ( headers ) resp , err := c . transport . Do ( req ) if err != nil { return RESTResponse { } , errors . Trace ( err ) } defer func ( ) { _ = resp . Body . Close ( ) } ( ) if err := httprequest . UnmarshalJSONResponse ( resp , result ) ; err != nil { return RESTResponse { } , errors . Annotate ( err , " " ) } return RESTResponse { StatusCode : resp . StatusCode , } , nil }
Get makes a GET request to the given path in the CharmHub (not
including the host name or version prefix but including a leading /),
parsing the result as JSON into the given result value, which should
be a pointer to the expected data, but may be nil if no result is
desired.
Get makes a GET request to the given path in the CharmHub ( not including the host name or version prefix but including a leading / ) parsing the result as JSON into the given result value which should be a pointer to the expected data but may be nil if no result is desired .
// Compose the request headers. // Parse the response.