2
0
mirror of https://github.com/hibiken/asynq.git synced 2026-06-14 19:59:46 +08:00

feat: Add an option to specify headers

This commit is contained in:
kayoch1n
2026-03-17 12:29:58 +08:00
parent d704b68a42
commit 5c391f3ffb
4 changed files with 110 additions and 1 deletions

View File

@@ -5,6 +5,7 @@
package asynq
import (
"encoding/json"
"fmt"
"strconv"
"strings"
@@ -1002,6 +1003,13 @@ func parseOption(s string) (Option, error) {
return nil, err
}
return Retention(d), nil
case "Header":
var h [2]string
err := json.Unmarshal([]byte(arg), &h)
if err != nil {
return nil, err
}
return Header(h[0], h[1]), nil
default:
return nil, fmt.Errorf("cannot not parse option string %q", s)
}