Skip to content
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

Fix minor mistake in HeadersRegexp doc #667

Closed
wants to merge 3 commits into from

Conversation

Algebra8
Copy link

Fixes #666

Summary of Changes

  1. Fixed mistake in HeadersRegexp docs.

PS: Make sure your PR includes/updates tests! If you need help with this part, just ask!

Since this is a doc change I don't think it needs tests.

@ya5u
Copy link

ya5u commented Feb 8, 2022

@Algebra8 LGTM!
BTW, func (*Route) Host and some of the methods have the same mistake, so why not fix them together?

@andrew-werdna
Copy link
Contributor

Since Router and Route both share some method names in common (where the Router just calls r.NewRoute().<Method>(...) I think that many of the examples are actually syntactically correct. However, the intent may have been to demonstrate something a Route can do specifically. I have updated all the instances where this occurred and have opened a PR for this here

@Algebra8
Copy link
Author

Sorry for the delay, I got busy with some other things and lost track of this issue 😞

@andrew-werdna thanks for bringing that point up, and it's a great point, but in my opinion the documentation should reflect the outer most visibility to the user and it's not great ux for the user to have to dig into the source code to come to the same realization you did.

And thanks for the PR!

@andrew-werdna
Copy link
Contributor

I think I know what you mean. I had to read the source code just now to discover that both Router and Route types shared multiple method names.

Copy link

@james-d-elliott james-d-elliott left a comment

Choose a reason for hiding this comment

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

LGTM

@amustaque97
Copy link
Contributor

amustaque97 commented Jun 7, 2022

@elithrar we can merge this PR. Let me know WDYT?

Copy link
Contributor

@amustaque97 amustaque97 left a comment

Choose a reason for hiding this comment

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

@andrew-werdna thanks for bringing that point up, and it's a great point, but in my opinion, the documentation should reflect the outermost visibility to the user and it's not great UX for the user to have to dig into the source code to come to the same realization you did.

Hi @Algebra8, I had a closer look at the code I believe we shouldn't update the docs but rather add a new method HeadersRegexp in the mux.go file like it is done for other multiple methods.

UPDATE: I'm okay with the current changes. Because going forward if someone gets maintainership then the maintainer may remove duality as mentioned in the v2 proposal here: #387 (comment)

I'm not saying the v2 proposal is finalised but there are higher chances of getting it fixed/released.

@codecov
Copy link

codecov bot commented Aug 16, 2023

Codecov Report

Merging #667 (c37390b) into main (395ad81) will increase coverage by 0.43%.
Report is 1 commits behind head on main.
The diff coverage is n/a.

❗ Current head c37390b differs from pull request most recent head 5e94bf4. Consider uploading reports for the commit 5e94bf4 to get more accurate results

@@            Coverage Diff             @@
##             main     #667      +/-   ##
==========================================
+ Coverage   78.01%   78.44%   +0.43%     
==========================================
  Files           5        5              
  Lines         887      877      -10     
==========================================
- Hits          692      688       -4     
+ Misses        140      135       -5     
+ Partials       55       54       -1     
Files Changed Coverage Δ
route.go 69.29% <ø> (+0.83%) ⬆️

@coreydaley coreydaley enabled auto-merge (squash) August 16, 2023 02:01
@coreydaley
Copy link
Contributor

@apoorvajagtap ptal

coreydaley added a commit that referenced this pull request Aug 17, 2023
Fixes #666 

**Summary of Changes**

1. Update `Route` method documentation comments where the example in the
comments showed a `Router` before. Updated method names include:
    * `Headers`
    * `HeadersRegexp`
    * `Host`
    * `Path`
    * `Queries`
    * `Subrouter`
    * `URL`

Notes:
* This includes what PR #667 did plus some changes requested by a
maintainer in the comments
* I was a little torn about changing the example in `Subrouter` since
`(*Router).Host()` (like several `(*Router)` methods) just calls
`(*Router).NewRoute().Host()` so I understand if maintainers are
ambivalent about that example or want it to remain the same.

Signed-off-by: Corey Daley <[email protected]>
Co-authored-by: Andrew Brown <[email protected]>
Co-authored-by: Corey Daley <[email protected]>
@apoorvajagtap
Copy link
Member

apoorvajagtap commented Aug 17, 2023

@coreydaley I think we can close this one, as #672 incorporates HeadersRegexp. Let me know in case I missed anything.

@james-d-elliott
Copy link

I agree with that assessment. You could probably merge main into this to be absolutely sure.

@coreydaley
Copy link
Contributor

Has already been fixed in #672

@coreydaley coreydaley closed this Aug 17, 2023
auto-merge was automatically disabled August 17, 2023 10:34

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[bug] Documentation for func (*Route) HeadersRegexp is incorrect
9 participants