Skip to content

Commit

Permalink
修复response_rewrite_v2插件配置空指针问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Dot-Liu committed Dec 22, 2024
1 parent d7e2d87 commit 713288e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/plugins/response-rewrite_v2/match.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ func newMatcher(statusCode int, headerMatches []*HeaderMatchRule, bodyMatch *Mat
header[rule.HeaderKey] = newContentMatcher(rule.Content, rule.MatchType, false)
}

return &matcher{
m := &matcher{
statusCode: statusCode,
header: header,
body: newContentMatcher(bodyMatch.Content, bodyMatch.MatchType, needParseVariable),
}
if bodyMatch != nil {
m.body = newContentMatcher(bodyMatch.Content, bodyMatch.MatchType, needParseVariable)
}
return m
}

func (m *matcher) Match(ctx http_service.IHttpContext) (map[string]string, bool) {
Expand Down

0 comments on commit 713288e

Please sign in to comment.