Skip to content

Commit

Permalink
Merge pull request #51 from G-Core/feature/CDI-468_add_origin_shielding
Browse files Browse the repository at this point in the history
CDI-468: fix error with null value
  • Loading branch information
anton-sharonov authored Mar 12, 2024
2 parents e256a19 + 09638f0 commit 866d385
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions originshielding/originshielding.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import (
type OriginShieldingService interface {
Update(ctx context.Context, id int64, req *UpdateRequest) (*OriginShieldingData, error)
Get(ctx context.Context, id int64) (*OriginShieldingData, error)
GetLocations(ctx context.Context) ([]OriginShieldingLocations, error)
GetLocations(ctx context.Context) (*[]OriginShieldingLocations, error)
}

type OriginShieldingData struct {
ShieldingPop int `json:"shielding_pop"`
ShieldingPop *int `json:"shielding_pop"`
}

type UpdateRequest struct {
ShieldingPop int `json:"shielding_pop"`
ShieldingPop *int `json:"shielding_pop"`
}

type OriginShieldingLocations struct {
Expand Down
6 changes: 3 additions & 3 deletions originshielding/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ func (s *Service) Get(ctx context.Context, id int64) (*OriginShieldingData, erro

}

func (s *Service) GetLocations(ctx context.Context) ([]OriginShieldingLocations, error) {
func (s *Service) GetLocations(ctx context.Context) (*[]OriginShieldingLocations, error) {
var originShieldingLocations []OriginShieldingLocations
if err := s.r.Request(ctx, http.MethodGet, "/cdn/shieldingpop_v2", nil, originShieldingLocations); err != nil {
if err := s.r.Request(ctx, http.MethodGet, "/cdn/shieldingpop_v2", nil, &originShieldingLocations); err != nil {
return nil, fmt.Errorf("request: %w", err)
}

return originShieldingLocations, nil
return &originShieldingLocations, nil
}

0 comments on commit 866d385

Please sign in to comment.