feat: enhance extension API (#1413)

This commit is contained in:
Levi authored and GitHub committed 2026-07-14 20:52:21 +08:00
1 parent 9fb3758203
commit fdfc6902a7
10 files changed
+96 -46

No files matched your search

+18
View File
@@ -25,6 +25,24 @@ type Request struct {
SkipVerifyCert bool `json:"skipVerifyCert"`
}
// SetLabels replaces all labels on the request.
func (r *Request) SetLabels(labels map[string]string) {
r.Labels = labels
}
// PutLabel sets a label on the request.
func (r *Request) PutLabel(key, value string) {
if r.Labels == nil {
r.Labels = make(map[string]string)
}
r.Labels[key] = value
}
// DelLabel deletes a label from the request.
func (r *Request) DelLabel(key string) {
delete(r.Labels, key)
}
func (r *Request) Validate() error {
if r.URL == "" {
return fmt.Errorf("invalid request url")