-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Feature Proposal Description
This issue proposes to refactor the Req and Res structs into views/interfaces onto the Ctx interface. This should improve DX when adding new Ctx methods, as we currently have to manually write new function code in both ctx.go and either req.go or res.go.
This update would consist of:
- Using
ifacemaker(if possible) to generateCtx,Req, andResinterfaces for the sameDefaultCtxstruct - Updating
c.Req()andc.Res()to returnCtxbut type-casted to the appropriate interface
After this is done, Req and Res methods should then call the underlying Ctx method, since the Ctx interface implements both the Req and Res interfaces.
Originally posted by @grivera64 in #2894 (comment)
Alignment with Express API
This improvement shouldn't deviate from Fiber's alignment with the Express API, but rather updates the internal representation of the Req and Res struct into interfaces, which is part of the Express API.
HTTP RFC Standards Compliance
N/A
API Stability
Fiber's API will have improved stability, since all methods in Ctx will be automatically be used into the respective Req and Res interfaces. This will make it so that we don't accidentally forget to update the Req/Res implementations after making a change to the core Ctx methods.
Feature Examples
N/AChecklist:
- I agree to follow Fiber's Code of Conduct.
- I have searched for existing issues that describe my proposal before opening this one.
- I understand that a proposal that does not meet these guidelines may be closed without explanation.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status