From 0a6f43e28b7daa5012234e6c765b5803e8d67d9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=88=B4=E6=9C=A8=E6=B3=B0=E6=96=97?= Date: Sat, 21 Jun 2025 11:49:30 +0900 Subject: [PATCH] add constractors of BodyMatcher (NewJSONBodyMatcher, NewStringBodyMatcher) --- server/types/matchers.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/server/types/matchers.go b/server/types/matchers.go index 620b714..12fcf11 100644 --- a/server/types/matchers.go +++ b/server/types/matchers.go @@ -333,3 +333,19 @@ func (bm *BodyMatcher) UnmarshalYAML(unmarshal func(interface{}) error) error { bm.bodyJson = res return nil } + +func NewJSONBodyMatcher( + bodyJson map[string]StringMatcher, +) *BodyMatcher { + return &BodyMatcher{ + bodyJson: bodyJson, + } +} + +func NewStringBodyMatcher( + bodyString StringMatcher, +) *BodyMatcher { + return &BodyMatcher{ + bodyString: &bodyString, + } +}