Remove the loop, we need only a single attribute
@@ -297,8 +297,7 @@ func ApplyResponseContext(ctx context.Context, body hcl.Body, beresp *http.Respo
}
content, _, _ := body.PartialContent(config.BackendInlineSchema)
- for _, attr := range content.Attributes {
- if attr.Name == "set_response_status" {
+ if attr, ok := content.Attributes["set_response_status"]; ok {
var httpCtx *hcl.EvalContext
if c, ok := ctx.Value(ContextType).(*Context); ok {
httpCtx = c.eval
@@ -329,9 +328,6 @@ func ApplyResponseContext(ctx context.Context, body hcl.Body, beresp *http.Respo
}
beresp.StatusCode = int(status)
-
- break
- }
}
return nil
