// Get sends an HTTP GET. The HTTP request is first signed and the signature is added to the request header.
Get sends an HTTP GET. The HTTP request is first signed and the signature is added to the request header.
// Get sends an HTTP GET . The HTTP request is first signed and the signature is added to the request header .
func (t *Transport) Get(ctx context.Context, r *Request) (*http.Response, error) {
	req, err := http.NewRequestWithContext(ctx, http.MethodGet, r.URL.String(), nil)
	if err != nil {
		return nil, fmt.Errorf("get from %s: %w", r.URL, err)
	}
	for k, v := range r.Header {
		req.Header[k] = v
	}
	authRequired, err := t.tokenMgr.IsAuthRequired(r.URL.Path, http.MethodGet)
	if err != nil {
		return nil, fmt.Errorf("is authorization required: %w", err)
	}
	if authRequired {
		err = t.getSigner.SignRequest(t.publicKeyID.String(), req)
		if err != nil {
			return nil, fmt.Errorf("sign request: %w", err)
		}
		logger.Debugf("Signed HTTP GET to %s. Headers: %s", r.URL, req.Header)
	} else {
		logger.Debugf("HTTP signature is not required for HTTP GET to %s", r.URL)
	}
	return t.client.Do(req)
}
func ( t * Transport ) Get ( ctx context . Context , r * Request ) ( * http . Response , error ) { req , err := http . NewRequestWithContext ( ctx , http . MethodGet , r . URL . String ( ) , nil ) if err != nil { return nil , fmt . Errorf ( " " , r . URL , err ) } for k , v := range r . Header { req . Header [ k ] = v } authRequired , err := t . tokenMgr . IsAuthRequired ( r . URL . Path , http . MethodGet ) if err != nil { return nil , fmt . Errorf ( " " , err ) } if authRequired { err = t . getSigner . SignRequest ( t . publicKeyID . String ( ) , req ) if err != nil { return nil , fmt . Errorf ( " " , err ) } logger . Debugf ( " " , r . URL , req . Header ) } else { logger . Debugf ( " " , r . URL ) } return t . client . Do ( req ) }
Get sends an HTTP GET.
Get sends an HTTP GET .