MCPcopy Create free account
hub / github.com/compozy/agh / newRequest

Method newRequest

internal/registry/github/client.go:620–630  ·  view source on GitHub ↗
(ctx context.Context, rawURL string, accept string)

Source from the content-addressed store, hash-verified

618}
619
620func (c *Client) newRequest(ctx context.Context, rawURL string, accept string) (*http.Request, error) {
621 request, err := http.NewRequestWithContext(ctx, http.MethodGet, rawURL, http.NoBody)
622 if err != nil {
623 return nil, fmt.Errorf("github: create request %q: %w", rawURL, err)
624 }
625 request.Header.Set("Accept", accept)
626 if token := strings.TrimSpace(c.token); token != "" {
627 request.Header.Set("Authorization", "Bearer "+token)
628 }
629 return request, nil
630}
631
632func (c *Client) handleRequestError(ctx context.Context, err error) (error, error) {
633 if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) || ctx.Err() != nil {

Callers 1

doRequestMethod · 0.95

Calls 1

SetMethod · 0.45

Tested by

no test coverage detected