Documentation ¶
Index ¶
- Variables
- func Compare(ignore, ignoreMissing []string, ignoreNull bool, lhs, rhs interface{}) ([]string, error)
- func CompareHeaders(ignore, ignoreContent []string, lhs, rhs http.Header) ([]string, error)
- func FindVersions(dir string, verbose bool, constraints Constraints) (files []string, err error)
- func GetRequestsFiles(dirname string) (files []string, err error)
- func GetResponseFilename(reqFname string) (string, error)
- func IsRequestFilename(fname string) bool
- func MatchPath(pattern, fpath string) (bool, error)
- func NameFromReqFileName(fname string) (string, error)
- func Prune(d diff.Differ, ignoreNull bool) diff.Differ
- func ReadResponse(req *http.Request, reqFname string) (resp *http.Response, err error)
- func ReqFileName(name, dir string) string
- func VersionMatch(verbose bool, constraints Constraints, s string) (bool, error)
- type Constraints
- type IgnoreMissingPrunner
- type IgnorePrunner
- type Saver
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Compare ¶
func Compare(ignore, ignoreMissing []string, ignoreNull bool, lhs, rhs interface{}) ([]string, error)
Compare returns a list of differences between two json objects. The ignore and ignoreMissing parameters are a list of JSON paths that should be ignored. If ignoreNull is true, nil values in the lhs won't be tested.
func CompareHeaders ¶
CompareHeaders returns a list of differences between two http.Header. ignore and ignoreContent are expected to be normalized http headers names.
func FindVersions ¶
func FindVersions(dir string, verbose bool, constraints Constraints) (files []string, err error)
FindVersions returns the versions (folders) found that match the provided constraints
func GetRequestsFiles ¶
GetRequestsFiles returns a list of request files matching the _req[0-9]*.txt pattern
func GetResponseFilename ¶
GetResponseFilename transform a _req[0-9]*.txt filename into a _resp[0-9]*.txt
func IsRequestFilename ¶ added in v0.0.4
IsRequestFilename returns true if fname matches the request filename pattern (_req[0-9]*.txt)
func MatchPath ¶
MatchPath uses path.Match to match a full path against a pattern. In addition to the path.Match pattern syntax, \** can be used to match any number of folder names.
func NameFromReqFileName ¶ added in v0.0.4
NameFromReqFileName extracts the request name from the filename (removing the _req[0-9]*.txt suffix)
func Prune ¶
Prune returns a diff.Differ, stripping the diff tree of the following differences:
- Excess keys in the right hand side - Excess and Missing values in slices - Values of the same type with different content (excluding slices and maps) - Type difference where null is involved
func ReadResponse ¶
ReadResponse reads the response in reqFname given the provided request
func ReqFileName ¶ added in v0.0.2
ReqFileName finds the first appropriate request filename that doesn't translate to an existing file on disk
Types ¶
type Constraints ¶
Constraints is an interface for semver.Constraints
type IgnoreMissingPrunner ¶
type IgnoreMissingPrunner []string
IgnoreMissingPrunner can be used to ignore missing json paths (from the right hand side) in a diff tree
type IgnorePrunner ¶
type IgnorePrunner []string
IgnorePrunner can be used to ignore json paths in a diff tree
type Saver ¶ added in v0.0.2
type Saver struct {
// contains filtered or unexported fields
}
Saver is used to handle saving or requests and responses to a new version
func NewSaver ¶ added in v0.0.2
NewSaver returns a *Saver. `dir` is the output folder and `fname` is the name of the original request file
func (*Saver) SaveRequest ¶ added in v0.0.2
SaveRequest moves the request file to the new folder (as specified in NewSaver). The file name is adjusted if file with the same name already exists at that location and if the files are not identical.