Skip to content

Commit

Permalink
chore: add key for exact match
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuildthecloud committed Nov 11, 2024
1 parent 176942a commit 31f2edf
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/engine/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ func (e *Engine) runHTTP(ctx context.Context, prg *types.Program, tool types.Too
req.Header.Add("X-GPTScript-Env", k+"="+envMap[k])
}
}
for _, prefix := range strings.Split(os.Getenv("GPTSCRIPT_HTTP_ENV_PREFIX"), ",") {

for _, prefix := range strings.Split(envMap["GPTSCRIPT_HTTP_ENV_PREFIX"], ",") {
if prefix == "" {
continue
}
Expand All @@ -93,6 +94,16 @@ func (e *Engine) runHTTP(ctx context.Context, prg *types.Program, tool types.Too
}
}

for _, k := range strings.Split(envMap["GPTSCRIPT_HTTP_ENV"], ",") {
if k == "" {
continue
}
v := envMap[k]
if v != "" {
req.Header.Add("X-GPTScript-Env", k+"="+v)
}
}

req.Header.Set("X-GPTScript-Tool-Name", tool.Parameters.Name)

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

0 comments on commit 31f2edf

Please sign in to comment.