fix: add missing head handler for EndpointType #164
Merged
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 support for the HTTP
HEADmethod across various endpoints and structures in the codebase. It ensures thatHEADrequests are properly handled in both core functionality and examples, while also updating related authentication and middleware logic.Support for
HEADmethod in endpoints:headmethod to multiple endpoint structs, includingMyEndpoint,SimpleEndpoint,ErrorEndpoint,StopEndpoint,HtmlEndpoint, andUserWeb, enabling them to handleHEADrequests. ([[1]](https://github.com/zigzap/zap/pull/164/files#diff-146a459eb4ae8d10d2699ccb000c4f6a750d9a8bd4c25290d0b212db3f74dec3R68),[[2]](https://github.com/zigzap/zap/pull/164/files#diff-3bdafe3135ec8926afcba258bffc5ebacb513f1a41b508e91f6bbaf0b40aad10R69),[[3]](https://github.com/zigzap/zap/pull/164/files#diff-76e6ff01f25c8c789cc21480ddc2b2e0418780e50a9ae5f14041199c079c7faeR56),[[4]](https://github.com/zigzap/zap/pull/164/files#diff-a5c3f42c7324c64cc8830efcb8822a1ada8540d9d66135f67b2cf97fb58c103dR26),[[5]](https://github.com/zigzap/zap/pull/164/files#diff-ba39abdb36f2a4f6fc4ec388f86acb13dbc342d7f9aeca599550e4dd60271242R160),[[6]](https://github.com/zigzap/zap/pull/164/files#diff-cd028a11497e4e351d65564f1915f763908f20bacf6587b88a83064585cc508cL130-R135))UserWeb'soptionsmethod to includeHEADin theAccess-Control-Allow-Methodsheader. ([examples/endpoint/userweb.zigL130-R135](https://github.com/zigzap/zap/pull/164/files#diff-cd028a11497e4e351d65564f1915f763908f20bacf6587b88a83064585cc508cL130-R135))Core framework updates for
HEADmethod:src/App.zigto routeHEADrequests to the appropriateheadmethod in the endpoint. ([src/App.zigR120](https://github.com/zigzap/zap/pull/164/files#diff-aa9d26de9c6c82b2d1d0829bdd7b5c6bf4b8ce3968b9079121806eea654e1f25R120))headto the list of supported HTTP methods insrc/App.zig. ([src/App.zigR177](https://github.com/zigzap/zap/pull/164/files#diff-aa9d26de9c6c82b2d1d0829bdd7b5c6bf4b8ce3968b9079121806eea654e1f25R177))HEADrequests insrc/App.zigandsrc/endpoint.zig, ensuring proper handling of authenticatedHEADrequests. ([[1]](https://github.com/zigzap/zap/pull/164/files#diff-aa9d26de9c6c82b2d1d0829bdd7b5c6bf4b8ce3968b9079121806eea654e1f25R310-R318),[[2]](https://github.com/zigzap/zap/pull/164/files#diff-b6751b13bfcd4e31d24370fa695d8d43f27d86397e31e166572047b340cec172R302-R310))Documentation and validation updates:
src/endpoint.zigto include theheadmethod. ([[1]](https://github.com/zigzap/zap/pull/164/files#diff-b6751b13bfcd4e31d24370fa695d8d43f27d86397e31e166572047b340cec172R22),[[2]](https://github.com/zigzap/zap/pull/164/files#diff-b6751b13bfcd4e31d24370fa695d8d43f27d86397e31e166572047b340cec172R53),[[3]](https://github.com/zigzap/zap/pull/164/files#diff-b6751b13bfcd4e31d24370fa695d8d43f27d86397e31e166572047b340cec172R102))Middleware and testing:
src/middleware.zigto processHEADrequests. ([src/middleware.zigR112](https://github.com/zigzap/zap/pull/164/files#diff-96eb9e5cbd3c1ba3aac8e9cf89868e6309f0ef17e40bcf0dd85ff3b21cc9482cR112))headmethod to the testEndpointstruct insrc/tests/test_auth.zigto ensure test coverage forHEADrequests. ([src/tests/test_auth.zigR173](https://github.com/zigzap/zap/pull/164/files#diff-a2d4c702afe4c486e4acb56e8d068fb5e989c8c53fb0f610fe361655d325d7b0R173))