Add route after-response callbacks - #175
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5937418cad
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| public ApiResponse apiResponse() { | ||
| return apiResponse; |
There was a problem hiding this comment.
Return a read-only structured response snapshot
When an observational callback calls response.apiResponse().withStatusCode(...), setBody(...), or clearBody(), it mutates the same ApiResponse referenced by the returned HttpApiResponse; that class delegates status and body rendering to this object. The callback can therefore alter the caller-visible response despite this API being documented as immutable/read-only and preserving the already-rendered response. Expose a defensive/read-only representation instead of the mutable underlying object.
Useful? React with 👍 / 👎.
| httpResponse = | ||
| runRouteAfterResponseCallbacksOn( | ||
| request, httpResponse, effectiveVerb, lifecycle, parsedEnvelope); |
There was a problem hiding this comment.
Apply callbacks to the legacy query response path
When callers use the public query(HttpApiRequest, String) helper instead of queryRequest, execution never reaches this callback phase: that helper renders its GET response and returns directly through the legacy response hooks. Consequently, an afterResponse callback registered on the queried GET route silently does not run depending on which public HTTP entry point is used. Route this helper through the common response pipeline or explicitly invoke the new callback phase there.
Useful? React with 👍 / 👎.
Closes #174
Summary
afterResponsecallbacks that run after final response rendering and before legacy/global HTTP response hooks.Verification
mvn -q clean installalso passed locally and installed the updated snapshot, sources, and Javadocs to Maven local.