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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user