Skip to content

feat: [#510] Get origin route path#1062

Merged
hwbrzzl merged 2 commits intomasterfrom
bowen/#510
Jun 6, 2025
Merged

feat: [#510] Get origin route path#1062
hwbrzzl merged 2 commits intomasterfrom
bowen/#510

Conversation

@hwbrzzl
Copy link
Contributor

@hwbrzzl hwbrzzl commented Jun 6, 2025

📑 Description

Closes goravel/goravel#510

This pull request introduces enhancements to the ContextRequest interface and its associated mock implementation. The changes focus on adding support for retrieving the original path of an HTTP request, improving functionality and testing capabilities.

Enhancements to the ContextRequest interface:

  • Added a new method OriginPath() to retrieve the original path of the request (e.g., /users/{id}), alongside the existing Path() method for the current path (e.g., /users/1). (contracts/http/request.go, contracts/http/request.goL21-R23)

Updates to the mock implementation:

  • Implemented the OriginPath() method in the mock ContextRequest class, including helper methods (Run, Return, and RunAndReturn) for defining mock behavior and expectations. (mocks/http/ContextRequest.go, mocks/http/ContextRequest.goR1305-R1336)

✅ Checks

  • Added test cases for my code

Copilot AI review requested due to automatic review settings June 6, 2025 14:06
@hwbrzzl hwbrzzl requested a review from a team as a code owner June 6, 2025 14:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the HTTP request abstraction by introducing an OriginPath method to provide both the original and current request paths.

  • Introduces OriginPath() in the ContextRequest interface with its corresponding documentation.
  • Adds a new mock implementation for OriginPath, including helper functions for testing expectations.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
contracts/http/request.go Adds OriginPath() method to the interface with updated comments
mocks/http/ContextRequest.go Implements OriginPath() in the mock along with helper methods

@codecov
Copy link

codecov bot commented Jun 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.31%. Comparing base (6940493) to head (fa7d507).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1062   +/-   ##
=======================================
  Coverage   71.31%   71.31%           
=======================================
  Files         181      181           
  Lines       12732    12732           
=======================================
  Hits         9080     9080           
  Misses       3263     3263           
  Partials      389      389           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hwbrzzl hwbrzzl merged commit e1d6732 into master Jun 6, 2025
14 checks passed
@hwbrzzl hwbrzzl deleted the bowen/#510 branch June 6, 2025 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ [Feature] 获取路由的匹配表达式

2 participants