Unit tests and bug fixes#11
Merged
Merged
Conversation
Add a suite of unit tests and small test controllers to improve coverage around HTTP events and error handling. New tests include additional-details, endpoint-exists flag, base event helpers, HTTP method enum, HTTP response event helpers, non-existent endpoint request body preservation, response event request data, and runtime-exception-resolver behavior (default and include-message=ALWAYS). Also add ResponseEventDataTestController and RuntimeExceptionResolverTestController. Update ErrorTestControllerTest to include assertions for server/client error response helpers.
Replace the endpointExists property with endpointCalled throughout the codebase and update related logic and tests. - Rename HttpRequestEvent/BaseHttpEvent field and builder usage to endpointCalled. - Update CachedBodyHttpServletRequest, captor (RequestEndpointCalledCaptor), registry and publishers to set/check endpointCalled. - Change property name to web-captor.event-details.include-endpoint-called in examples and test resources and update tests accordingly (renamed test packages/files where applicable). - Update frontend types and UI (label and value) to reflect endpointCalled. - Fix request wrapper unwrapping in HttpServletUtils by using WebUtils.getNativeRequest to handle decorated requests (e.g. multipart wrappers). - Ensure HttpResponseEventPublisher publishes request/response wrapper objects and simplify RuntimeExceptionResolver to always include the error reason phrase. - Add comprehensive EndpointCalledFlagTest to cover various HTTP scenarios (including multipart behavior) and add IDE run configurations for demo/frontend.
Eagerly capture multipart file bytes on the backend and add download/preview support in the frontend. - Backend: add serializedFiles field and eager serialization in BodyPayload to capture base64 content before multipart temp-file cleanup, plus a safe getter that returns an empty map when absent. - Frontend: enhance CapturedResult to show human-friendly sizes, provide a Download link for files, enlarge image previews, and add text/JSON preview (with pretty-printing). Also import new icons used for download/preview. - Demo: add demo-landscape.jpg and update demoData to fetch and send an image file in the multipart demo. - Tests: add MultipartFileContentTest to verify base64 content is captured and matches original file bytes. These changes ensure multipart file contents are reliably recorded and usable in the UI (download/preview) and covered by tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements and refactors to both the backend and frontend of the project, with a primary focus on renaming the
endpointExistsfield toendpointCalledthroughout the codebase, enhancing file upload demo functionality, and improving file preview and download capabilities in the frontend UI. Additionally, it updates configuration and run files to better support development workflows.Backend changes:
Renaming and refactoring for clarity:
endpointExistsfield toendpointCalledin all relevant backend classes, configuration properties, and event models to better reflect its semantics. This includes Java classes such asBaseHttpEvent,CachedBodyHttpServletRequest, and related captors, as well as YAML and property files. [1] [2] [3] [4] [5] [6] [7]File serialization improvements:
BodyPayloadclass to eagerly serialize uploaded files, ensuring base64 content is captured before Spring cleans up temporary files. This change adds aserializedFilesfield and makes file serialization more robust for multipart uploads.Bug fixes and minor refactors:
HttpServletUtilsto handle decorator chains, ensuring the correct request wrapper is always used. [1] [2]Frontend changes:
UI updates for clarity and usability:
endpointExiststoendpointCalledin TypeScript types and UI components for consistency with backend changes. [1] [2]landscape.jpg) instead of a text file, providing a more visually engaging example.Enhanced file preview and download:
CapturedResultcomponent. This enhances user experience when viewing captured multipart file uploads. [1] [2]Development workflow:
Run configuration improvements:
DemoApplication.run.xml), frontend (Run Frontend.run.xml), and a combined example (Run Example.run.xml) to streamline local development and testing. [1] [2] [3]