Skip to content

Commit

Permalink
add request debugging log
Browse files Browse the repository at this point in the history
  • Loading branch information
LexLuthr committed Feb 21, 2025
1 parent f4e227e commit 4944501
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions market/mk12/cidgravity.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"reflect"
"regexp"
"strings"

"golang.org/x/xerrors"

Expand Down Expand Up @@ -128,7 +129,7 @@ type cidGravityResponse struct {
MatchingRule int `json:"matchingRule"`
}

const cidGravityDealCheckUrl = "https://service.cidgravity.com/api/proposal/check"
const cidGravityDealCheckUrl = "https://api.cidgravity.com/api/proposal/check"
const cidGravityMinerCheckUrl = "https://service.cidgravity.com/private/v1/miner-status-checker/check"
const cidGravityMinerCheckLabel = "cidg-miner-status-check"
const agentName = "curio"
Expand All @@ -154,7 +155,7 @@ func (m *MK12) cidGravityCheck(ctx context.Context, deal *ProviderDealState) (bo
if err != nil {
return false, "", xerrors.Errorf("Error getting label string: %w", err)
}
if lableStr == cidGravityMinerCheckLabel {
if strings.HasPrefix(lableStr, cidGravityMinerCheckLabel) {
req, err = http.NewRequest("POST", cidGravityMinerCheckUrl, bytes.NewBuffer(data))
if err != nil {
return false, "", xerrors.Errorf("Error creating request: %w", err)
Expand All @@ -173,6 +174,12 @@ func (m *MK12) cidGravityCheck(ctx context.Context, deal *ProviderDealState) (bo
req.Header.Set("X-Address-ID", deal.ClientDealProposal.Proposal.Provider.String())
req.Header.Set("Authorization", m.cfg.Market.StorageMarketConfig.MK12.CIDGravityToken)

hdr, err := json.Marshal(req.Header)
if err != nil {
return false, "", xerrors.Errorf("Error marshaling headers: %w", err)
}
log.Debugw("cid gravity request ", "url", req.URL.String(), "headers", string(hdr), "body", string(data))

// Execute the request
resp, err := client.Do(req)
if err != nil {
Expand Down

0 comments on commit 4944501

Please sign in to comment.