Fix basic bugs and eliminate duplicate code across the framework#54
Draft
Fix basic bugs and eliminate duplicate code across the framework#54
Conversation
Co-authored-by: trapcodeio <48396844+trapcodeio@users.noreply.github.com>
- PathHelper.resolve: fix wrong replacement string (.ts.js → .ts) - InXpresserError: reuse single Date instance for date and dateString - RequestEngine.toApi: remove redundant double res.status() call - Helpers.randomStr: delegate to $.utils.randomStr() (no duplication) - Replace unsafe .hasOwnProperty() with Object.prototype.hasOwnProperty.call() in index.ts, RequestEngine, RouterEngine, and PluginEngine - Add tests/specs/fixes.spec.ts covering each fix Co-authored-by: trapcodeio <48396844+trapcodeio@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Analyze framework for mistakes and performance improvements
Fix basic bugs and eliminate duplicate code across the framework
Mar 6, 2026
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.
Five distinct bugs and code quality issues identified across the framework's core modules.
Bug Fixes
PathHelper.resolve— wrong replacement string (src/Helpers/Path.ts): The.ts.js → .tsnormalisation branch was calling.replace('.js.js', '.ts')instead of.replace('.ts.js', '.ts'), so paths likeAuthController.ts.jswere never actually fixed.InXpresserError— twoDateinstances per error (src/Errors/InXpresserError.ts): Constructor callednew Date()twice, meaningdateanddateStringcould represent different moments under load.dateStringnow derives fromthis.date.RequestEngine.toApi— doubleres.status()call (src/RequestEngine.ts):toApicalledthis.res.status(status)explicitly, then passedstatustothis.json()which callsthis.status()again. The explicit pre-call is removed.Code Quality
helpers.randomStr— triplicated logic (src/Extensions/Helpers.ts): Identical character-loop existed ininbuilt.fn.ts,util.fn.ts, andhelpers.ts. The helper now delegates to$.utils.randomStr().Unsafe
.hasOwnProperty()calls (index.ts,RequestEngine,RouterEngine,PluginEngine): Direct method calls fail on null-prototype objects and are spoofable if the property is shadowed. All hot-path usages replaced withObject.prototype.hasOwnProperty.call(obj, key).🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.