Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .mise.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tools]
go = "1.25"
golangci-lint = "2.7.2"
golangci-lint = "2.8.0"
dprint = "0.51.1"
hk = "1.29.0"
just = "1.46.0"
Expand Down
10 changes: 1 addition & 9 deletions pkg/httpcheck/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (c *Check) Run() check.Result {

// Check --json-path
if c.JSONPath != "" {
path, expectedValue, hasExpectedValue := parseJSONPath(c.JSONPath)
path, expectedValue, hasExpectedValue := strings.Cut(c.JSONPath, "=")
jsonResult := jsonpath.Get(respBody, path)
if !jsonResult.Exists() {
lastErr = fmt.Errorf("JSON path %q not found", path)
Expand Down Expand Up @@ -248,11 +248,3 @@ func (c *Check) Run() check.Result {
// Should not reach here, but handle edge case
return result.Failf("unexpected error: %v", lastErr)
}

// parseJSONPath parses "path=value" or "path" format.
func parseJSONPath(jsonPath string) (path, expectedValue string, hasExpectedValue bool) {
if idx := strings.Index(jsonPath, "="); idx != -1 {
return jsonPath[:idx], jsonPath[idx+1:], true
}
return jsonPath, "", false
}