-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds response header handling and unit tests #12
Commits on Jan 29, 2024
-
feat: Add TriggerStyle enum and HtmxResponse methods
This commit adds a new file `TriggerStyle.cs` which contains the `TriggerStyle` enum. The enum defines three trigger styles for events in an HTMX response. In addition, this commit modifies the `HtmxResponse.cs` file to include several new methods: - `Location(string url)`: Sets the location header for client-side redirect. - `PushUrl(string url)`: Pushes a new URL onto the history stack. - `Redirect(string url)`: Sets the redirect header for client-side redirect. - `Refresh()`: Enables a client-side full refresh of the page. - `ReplaceUrl(string url)`: Replaces the current URL in the location bar. - `Reswap(SwapStyle swapStyle)`: Allows specifying how the response will be swapped. - `Retarget(string selector)`: Updates the target of content update to a different element on the page. - `Reselect(string selector)`: Allows choosing which part of the response is used to be swapped in. - `Trigger(string eventName, object? detail = null, TriggerStyle timing = TriggerStyle.Default)`: Triggers client-side events with optional event details and timing. These changes enhance functionality related to handling HTMX responses.
Configuration menu - View commit details
-
Copy full SHA for 1218d53 - Browse repository at this point
Copy the full SHA 1218d53View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6f60290 - Browse repository at this point
Copy the full SHA 6f60290View commit details -
Switch from HashSet to retain event ordering
Switch from HashSet to retain event ordering The code changes in this commit switch from using a HashSet to using a List in order to retain the ordering of events. This change ensures that the events are stored and outputted in the same order they were added, which is important for maintaining consistency. Additionally, a boolean variable "exists" is introduced to check if an event already exists before adding it to the list.
Configuration menu - View commit details
-
Copy full SHA for 12b9cd2 - Browse repository at this point
Copy the full SHA 12b9cd2View commit details
Commits on Jan 30, 2024
-
feat: Add HtmxResponse class tests
This commit adds the HtmxResponse class implementation, which is responsible for handling HTTP responses in the Htmxor library. It includes methods for adding various response headers such as Location, PushUrl, Redirect, Refresh, ReplaceUrl, Reswap, Retarget, Reselect, and Trigger. The commit also includes unit tests for each of these methods to ensure their functionality. The tests cover scenarios such as adding different headers with different values and checking if the headers are correctly set in the response. Additionally, a MockHeaderDictionary class is added to provide a mock implementation of the IHeaderDictionary interface for testing purposes. This allows us to simulate HTTP headers in our unit tests without relying on actual HTTP requests or responses. Overall, this commit introduces the necessary code changes to support Htmx response handling and provides comprehensive test coverage for this functionality.
Configuration menu - View commit details
-
Copy full SHA for 2435f57 - Browse repository at this point
Copy the full SHA 2435f57View commit details -
Configuration menu - View commit details
-
Copy full SHA for 413d468 - Browse repository at this point
Copy the full SHA 413d468View commit details -
Configuration menu - View commit details
-
Copy full SHA for bbc37a5 - Browse repository at this point
Copy the full SHA bbc37a5View commit details -
Configuration menu - View commit details
-
Copy full SHA for cd20c02 - Browse repository at this point
Copy the full SHA cd20c02View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0da37bc - Browse repository at this point
Copy the full SHA 0da37bcView commit details -
refactor: refactor mock HTTP classes for testing purposes
- Change access modifiers from internal to public in `MockHeaderDictionary`, `MockHttpContext`, `MockHttpRequest`, `MockHttpResponse`, and `MockResponseCookies` classes.
Configuration menu - View commit details
-
Copy full SHA for 26b32e0 - Browse repository at this point
Copy the full SHA 26b32e0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9defd75 - Browse repository at this point
Copy the full SHA 9defd75View commit details -
Configuration menu - View commit details
-
Copy full SHA for e2da8bd - Browse repository at this point
Copy the full SHA e2da8bdView commit details -
Configuration menu - View commit details
-
Copy full SHA for 594a60e - Browse repository at this point
Copy the full SHA 594a60eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 88c3e4a - Browse repository at this point
Copy the full SHA 88c3e4aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 85c64b7 - Browse repository at this point
Copy the full SHA 85c64b7View commit details
Commits on Jan 31, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 59b6c6a - Browse repository at this point
Copy the full SHA 59b6c6aView commit details -
refactor: Update HtmxResponse.cs with a static JsonSerializerOptions
- Make _serializerOptions field static for improved performance and memory usage.
Configuration menu - View commit details
-
Copy full SHA for 530bb1f - Browse repository at this point
Copy the full SHA 530bb1fView commit details -
refactor: simple aggregate of existing headers and merge event with d…
…etail into the result This commit modifies the `MergeTrigger` method in the `HtmxResponse` class. It introduces changes to aggregate existing headers and merge events with details into the result. The code now uses a `StringBuilder` to build the JSON representation of aggregated properties across all header values for a given header key. Duplicate keys are not removed for performance reasons, as the produced JSON is still valid. This approach does not validate any syntax of existing headers as a performance consideration.
Configuration menu - View commit details
-
Copy full SHA for aeac9cc - Browse repository at this point
Copy the full SHA aeac9ccView commit details
Commits on Apr 16, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 988b09b - Browse repository at this point
Copy the full SHA 988b09bView commit details