Outcome
Extend the HTTP JSON summary example so it proves both the successful WorkPaper-backed response and one invalid request path.
Likely files
examples/headless-workpaper/http-json-summary.ts
examples/headless-workpaper/README.md only if the expected output text changes
Suggested approach
The example already starts a local HTTP server, posts valid opportunity records, and asserts the computed JSON summary. Add one small invalid request check while the server is running, such as posting a non-array JSON body to /summary, and assert that the response status is 400 with a clear error string.
Keep the example deterministic and avoid adding dependencies.
Acceptance proof
Run:
cd examples/headless-workpaper
npm run http-json-summary
The script should still print the successful summary, and it should throw if the invalid request does not return the expected 400 error response.
Scope check
- Do not change the public success output unless necessary.
- Do not turn the example into a web framework demo.
- Keep the added assertion small and readable for someone new to the repo.
Outcome
Extend the HTTP JSON summary example so it proves both the successful WorkPaper-backed response and one invalid request path.
Likely files
examples/headless-workpaper/http-json-summary.tsexamples/headless-workpaper/README.mdonly if the expected output text changesSuggested approach
The example already starts a local HTTP server, posts valid opportunity records, and asserts the computed JSON summary. Add one small invalid request check while the server is running, such as posting a non-array JSON body to
/summary, and assert that the response status is400with a clear error string.Keep the example deterministic and avoid adding dependencies.
Acceptance proof
Run:
cd examples/headless-workpaper npm run http-json-summaryThe script should still print the successful summary, and it should throw if the invalid request does not return the expected
400error response.Scope check