response-mutate

command
v1.28.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 8 Imported by: 0

README

response-mutate

Demonstrates fault.ResponseMutate via adapter/http.MutateResponse.

A test server returns a valid 200 OK JSON body ({"name":"alice"}). The chaos rule rewrites the successful response body to malformed JSON before the client sees it, exercising the caller's decode-failure fallback: FetchName returns "unknown" instead of panicking or returning a bogus value.

go run .        # prints: unknown
go test ./...   # asserts the degraded path and the clean (no-chaos) path

Documentation

Overview

Command response-mutate demonstrates fault.ResponseMutate via adapter/http.MutateResponse: chaos corrupts the body of an otherwise successful 200 response, and the client's decode path degrades gracefully (returns "unknown") instead of crashing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL