// resolveDID makes DID resolution via HTTP.
resolveDID makes DID resolution via HTTP.
// resolveDID makes DID resolution via HTTP .
func (rr *Resolver) send(uri string) ([]byte, error) {
	req, err := url.Parse(uri)
	if err != nil {
		return nil, fmt.Errorf("failed to parse request URL[%s]: %w", uri, err)
	}
	resp, err := rr.httpClient.Get(context.Background(), transport.NewRequest(req,
		transport.WithHeader(transport.AcceptHeader, didLDJson)))
	if err != nil {
		return nil, fmt.Errorf("failed to execute GET call on %s: %w", req.String(), err)
	}
	defer func() {
		errClose := resp.Body.Close()
		if errClose != nil {
			logger.Errorf("failed to close response body for request[%s] : %s", req.String(), errClose.Error())
		}
	}()
	responseBody, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, fmt.Errorf("failed to read response body for request[%s]: %w", req.String(), err)
	}
	if resp.StatusCode == http.StatusOK && strings.Contains(resp.Header.Get("Content-type"), didLDJson) {
		return responseBody, nil
	} else if resp.StatusCode == http.StatusNotFound {
		return nil, fmt.Errorf("data not found for request[%s]. Response status code: %d. Response body: %s",
			req.String(), resp.StatusCode, string(responseBody))
	}
	return nil, fmt.Errorf("failed to retrieve data for request[%s]. Response status code: %d. Content-type: %s. Response body: %s", 
		req.String(), resp.StatusCode, resp.Header.Get("Content-type"), string(responseBody))
}
func ( rr * Resolver ) send ( uri string ) ( [ ] byte , error ) { req , err := url . Parse ( uri ) if err != nil { return nil , fmt . Errorf ( " " , uri , err ) } resp , err := rr . httpClient . Get ( context . Background ( ) , transport . NewRequest ( req , transport . WithHeader ( transport . AcceptHeader , didLDJson ) ) ) if err != nil { return nil , fmt . Errorf ( " " , req . String ( ) , err ) } defer func ( ) { errClose := resp . Body . Close ( ) if errClose != nil { logger . Errorf ( " " , req . String ( ) , errClose . Error ( ) ) } } ( ) responseBody , err := ioutil . ReadAll ( resp . Body ) if err != nil { return nil , fmt . Errorf ( " " , req . String ( ) , err ) } if resp . StatusCode == http . StatusOK && strings . Contains ( resp . Header . Get ( " " ) , didLDJson ) { return responseBody , nil } else if resp . StatusCode == http . StatusNotFound { return nil , fmt . Errorf ( " " , req . String ( ) , resp . StatusCode , string ( responseBody ) ) } return nil , fmt . Errorf ( " " , req . String ( ) , resp . StatusCode , resp . Header . Get ( " " ) , string ( responseBody ) ) }
resolveDID makes DID resolution via HTTP.
resolveDID makes DID resolution via HTTP .
//nolint:lll