MCPcopy Create free account
hub / github.com/WICG/webpackage / Validate

Method Validate

go/bundle/bundle.go:77–92  ·  view source on GitHub ↗

Validate performs basic sanity checks on the bundle.

()

Source from the content-addressed store, hash-verified

75
76// Validate performs basic sanity checks on the bundle.
77func (b *Bundle) Validate() error {
78 if b.PrimaryURL != nil {
79 hasExchangeForPrimaryURL := false
80 primaryURLString := b.PrimaryURL.String()
81 for _, e := range b.Exchanges {
82 if e.Request.URL.String() == primaryURLString {
83 hasExchangeForPrimaryURL = true
84 break
85 }
86 }
87 if !hasExchangeForPrimaryURL {
88 return fmt.Errorf("bundle: No exchange for primary URL %v", b.PrimaryURL)
89 }
90 }
91 return nil
92}

Callers 2

mainFunction · 0.95
NewSignerFunction · 0.45

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected