Skip to content

Commit 31f2edf

Browse files
chore: add key for exact match
1 parent 176942a commit 31f2edf

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

pkg/engine/http.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ func (e *Engine) runHTTP(ctx context.Context, prg *types.Program, tool types.Too
8282
req.Header.Add("X-GPTScript-Env", k+"="+envMap[k])
8383
}
8484
}
85-
for _, prefix := range strings.Split(os.Getenv("GPTSCRIPT_HTTP_ENV_PREFIX"), ",") {
85+
86+
for _, prefix := range strings.Split(envMap["GPTSCRIPT_HTTP_ENV_PREFIX"], ",") {
8687
if prefix == "" {
8788
continue
8889
}
@@ -93,6 +94,16 @@ func (e *Engine) runHTTP(ctx context.Context, prg *types.Program, tool types.Too
9394
}
9495
}
9596

97+
for _, k := range strings.Split(envMap["GPTSCRIPT_HTTP_ENV"], ",") {
98+
if k == "" {
99+
continue
100+
}
101+
v := envMap[k]
102+
if v != "" {
103+
req.Header.Add("X-GPTScript-Env", k+"="+v)
104+
}
105+
}
106+
96107
req.Header.Set("X-GPTScript-Tool-Name", tool.Parameters.Name)
97108

98109
if err := json.Unmarshal([]byte(input), &map[string]any{}); err == nil {

0 commit comments

Comments
 (0)