Atlas › Test

invalid_url_empty

Exact test identity: go.temporal.io/server/common/nexus/nexusrpc/TestEncodeLink/invalid_url_empty

Package
go.temporal.io/server/common/nexus/nexusrpc
Suite / test hierarchy
TestEncodeLink/invalid_url_empty
Test
invalid_url_empty
Introduced at
api.go ×1 Frontier kind: Joint frontier
Covered ranges
4
Covered lines
8
Covered files
1

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/common/nexus/nexusrpc/api.go 8 covered LOC · 4 ranges

Open complete file

140 // decodeLink encodes the link to Nexus-Link header value.
141 // It follows the same format of HTTP Link header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link
142 > func encodeLink(link nexus.Link) (string, error) { api.go
143 > if err := validateLinkURL(link.URL); err != nil {
144 > return "", fmt.Errorf("failed to encode link: %w", err) api.go
145 > }
146 if err := validateLinkType(link.Type); err != nil {
147 return "", fmt.Errorf("failed to encode link: %w", err)
229 }
230
231 > func validateLinkURL(value *url.URL) error { api.go
232 > if value == nil || value.String() == "" {
233 > return errors.New("url is empty") api.go
234 > }
235 _, err := url.ParseQuery(value.RawQuery)
236 if err != nil {