Skip to content

Instantly share code, notes, and snippets.

@suntong
Created November 1, 2015 22:12
Show Gist options
  • Save suntong/e4cc51fb6e6c3eefe497 to your computer and use it in GitHub Desktop.
Save suntong/e4cc51fb6e6c3eefe497 to your computer and use it in GitHub Desktop.
func getReqAddons(r Request) string {
var buf bytes.Buffer
if len(r.RequestPlugins.RequestPlugin) != 0 {
for _, v := range r.RequestPlugins.RequestPlugin {
fmt.Fprintf(&buf, "  R: (%s) %s\n", v.Name,
minify(v.RuleParameters.Xml))
}
}
if len(r.ExtractionRules.ExtractionRule) != 0 {
for _, v := range r.ExtractionRules.ExtractionRule {
fmt.Fprintf(&buf, "  E: (%s: %s) %s\n", v.Name, v.VariableName,
minify(v.RuleParameters.Xml))
}
}
if len(r.ValidationRules.ValidationRule) != 0 {
for _, v := range r.ValidationRules.ValidationRule {
fmt.Fprintf(&buf, "  V: (%s) %s\n", v.Name,
minify(v.RuleParameters.Xml))
}
}
buf.WriteByte('\n')
return buf.String()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment