-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
middleware: add static middleware #3006
Conversation
WalkthroughThe changes involve merging the Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant User
participant FiberApp
participant StaticMiddleware
participant FileSystem
User->>FiberApp: Request static file
FiberApp->>StaticMiddleware: Serve static file
StaticMiddleware->>FileSystem: Fetch file
FileSystem-->>StaticMiddleware: Return file
StaticMiddleware-->>FiberApp: Serve file
FiberApp-->>User: Return file to user
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (2)
go.mod
is excluded by!**/*.mod
,!**/*.mod
go.sum
is excluded by!**/*.sum
,!**/*.sum
Files selected for processing (6)
- constants.go (1 hunks)
- docs/middleware/static.md (1 hunks)
- middleware/static/config.go (1 hunks)
- middleware/static/static.go (1 hunks)
- middleware/static/static_test.go (1 hunks)
- router.go (1 hunks)
Files skipped from review due to trivial changes (1)
- router.go
Additional Context Used
LanguageTool (1)
docs/middleware/static.md (1)
Near line 103: The usual preposition is ‘at’.
Context: ...you need to use wildcard (*
) operator in the end of the route. ::: ## Config | Property ...
Additional comments not posted (23)
middleware/static/config.go (3)
10-65
: TheConfig
struct is well-defined and appropriately documented, covering all necessary middleware customization options.
67-71
: TheConfigDefault
variable correctly implements sensible defaults for the static middleware.
73-93
: TheconfigDefault
function effectively handles default configurations and user overrides, ensuring that all configurations are correctly initialized.middleware/static/static.go (2)
15-145
: TheNew
function is well-implemented, efficiently handling the initialization and operation of the static middleware with appropriate checks and configurations.
147-170
: TheisFile
function correctly determines if the specified root is a file, supporting both embedded and traditional file systems efficiently.docs/middleware/static.md (1)
1-129
: The documentation for the Static middleware is comprehensive and well-structured, providing clear guidance on usage and configuration.constants.go (1)
35-35
: The addition ofMIMETextCSSCharsetUTF8
is correctly implemented and follows the established pattern of MIME type definitions in the framework.middleware/static/static_test.go (16)
17-48
: Ensure comprehensive testing for default index serving.This test effectively checks the basic functionality of serving an index file and handling not found errors. It's well-structured and covers the essential assertions.
80-94
: Properly tests the MaxAge configuration for cache control.The test is well-implemented, checking both the status code and the Cache-Control header to ensure the MaxAge setting is respected.
97-117
: Ensure the custom Cache-Control logic is correctly tested.This test effectively checks the customization of the Cache-Control header based on the content type, using a middleware function to achieve this. The assertions are appropriate and cover the necessary conditions.
120-134
: Correctly tests the forced download functionality.The test is well-structured and effectively checks the Content-Disposition header to ensure that the file is prompted for download as expected.
137-165
: Effectively tests static file serving within a grouped route.This test is comprehensive, checking both the custom header set by the group middleware and the correct serving of the static file. It ensures that the middleware and static serving work correctly in a grouped route context.
167-183
: Properly tests wildcard route handling for static files.The test correctly verifies that files are served under wildcard routes, ensuring that the static middleware handles wildcard paths appropriately.
185-209
: Effectively tests static file serving under routes with a prefix and wildcard.This test is well-implemented, ensuring that static files are served correctly under routes that include both a prefix and a wildcard, covering an important routing scenario.
211-240
: Correctly tests static file serving under prefixed routes.The test effectively verifies that static files are served correctly under prefixed routes, ensuring that the middleware handles prefixed paths appropriately.
242-286
: Properly tests static file serving with trailing slashes in the route.This test is comprehensive, checking file serving behavior both with and without trailing slashes, ensuring that the middleware handles these scenarios correctly.
289-332
: Effectively tests theNext
functionality for conditionally skipping the static middleware.This test correctly implements and verifies the
Next
functionality, ensuring that the static middleware can be conditionally skipped based on a custom header, which is crucial for flexible middleware behavior.
334-369
: Properly tests static file serving from the root directory with and without theBrowse
option.This test is well-structured, checking both the file serving and the directory browsing functionality from the root directory, ensuring that the
Browse
option works as expected.
371-453
: Effectively tests static file serving from a directory with a prefix in the route.This test correctly verifies that files are served and directory browsing is enabled from a directory with a prefix in the route, covering an important aspect of routing configuration.
456-478
: Properly tests the functionality of serving files from a filesystem using theFS
configuration.This test effectively checks that files are served correctly from the specified filesystem, ensuring that the
FS
configuration works as intended.
483-524
: Effectively tests the functionality of directory browsing with theFS
configuration using both embedded and directory filesystems.This test is comprehensive, checking that files are listed and served correctly from both embedded and directory filesystems, ensuring that the
FS
configuration supports different types of filesystems effectively.
526-545
: Correctly tests static file serving from a filesystem under routes with a prefix and wildcard.This test effectively verifies that static files are served correctly from a filesystem under routes that include both a prefix and a wildcard, covering an important routing scenario.
547-617
: Thoroughly tests theisFile
function with a variety of scenarios.This test is well-implemented, using a variety of test cases to verify the accuracy of the
isFile
function, ensuring that it correctly identifies files in different filesystem contexts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Out of diff range and nitpick comments (17)
register.go (7)
Line range hint
14-14
: Consider adding a brief description for theRegister
interface to enhance code readability and maintainability.
Line range hint
15-15
: TheRegistering
struct could benefit from a comment explaining its purpose and relationship with theApp
class.
Line range hint
15-15
: Thepath
field inRegistering
is not documented. Consider adding a comment to explain its usage.
Line range hint
15-15
: Theapp
field inRegistering
should be private if it's not intended to be accessed directly from outside the package.- app *App + app *app
Line range hint
15-15
: TheRegistering
struct could benefit from implementing a constructor function to ensure proper initialization of its fields.func NewRegistering(app *App, path string) *Registering { return &Registering{ app: app, path: path, } }
Line range hint
15-15
: The methodAll
inRegistering
does not handle the case wherehandler
isnil
. This could lead to runtime panics ifhandler
is not checked.Consider adding a nil check for
handler
before proceeding with the registration.func (r *Registering) All(handler Handler, middleware ...Handler) Register { + if handler == nil { + panic("handler cannot be nil") + } r.app.register([]string{methodUse}, r.path, nil, handler, middleware...) return r }
Line range hint
15-15
: TheAdd
method inRegistering
should validate themethods
slice to ensure it is not empty before proceeding with the registration.Add a check to ensure
methods
is not empty.func (r *Registering) Add(methods []string, handler Handler, middleware ...Handler) Register { + if len(methods) == 0 { + panic("methods cannot be empty") + } r.app.register(methods, r.path, nil, handler, middleware...) return r }group.go (2)
Line range hint
14-14
: TheGroup
struct should have a comment explaining its purpose and usage within the Fiber framework.
Line range hint
14-14
: TheName
method inGroup
does not handle the case wherename
is an empty string. Consider adding validation to prevent empty names.func (grp *Group) Name(name string) Router { + if name == "" { + panic("name cannot be empty") + } if grp.anyRouteDefined { grp.app.Name(name) return grp } ... }docs/api/app.md (1)
Line range hint
431-431
: Clarify the description ofNewCtxFunc
to improve readability.- NewCtxFunc allows to customize the ctx struct as we want. + NewCtxFunc allows customization of the ctx struct as needed.router.go (2)
14-14
: TheRouter
interface should include a comment explaining its purpose and the relationship between its methods and the Fiber framework's routing capabilities.
14-14
: TheRoute
struct should include comments for each field to explain their purpose and usage in routing.app.go (5)
Line range hint
1-1
: Update the project description to reflect recent changes.Consider updating the project description to include information about the new static middleware functionality.
Line range hint
1-1
: Check for potential typographical errors in the comments.Review the comments for any typographical errors to maintain professionalism in the codebase.
Line range hint
1-1
: Ensure all external links are secure (HTTPS).Verify that all external links in the comments use HTTPS to ensure security.
Line range hint
1-1
: Check for consistency in the formatting of headers in comments.Ensure that headers in comments are consistently formatted to improve readability.
[!TIP]
Codebase VerificationVerification of outdated information in comments
The comment in
app.go
does not mention Fasthttp or zero memory allocation, which are highlighted in the latest documentation (docs/intro.md
). This suggests that the comment might be outdated.
- Location in codebase:
app.go
lines 381-386Analysis chain
Line range hint
1-1
: Check for the presence of any outdated information in the comments.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for outdated information. # Test: Compare comments with the latest documentation. Expect: No discrepancies. rg --type markdown "zero memory allocation" docs/Length of output: 397
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (2)
go.mod
is excluded by!**/*.mod
,!**/*.mod
go.sum
is excluded by!**/*.sum
,!**/*.sum
Files selected for processing (9)
- .github/README.md (4 hunks)
- app.go (2 hunks)
- app_test.go (3 hunks)
- docs/api/app.md (2 hunks)
- docs/intro.md (1 hunks)
- group.go (1 hunks)
- register.go (2 hunks)
- router.go (3 hunks)
- router_test.go (1 hunks)
Files skipped from review due to trivial changes (2)
- app_test.go
- router_test.go
Additional Context Used
LanguageTool (18)
.github/README.md (13)
Near line 124: Consider using “incompatible” to avoid wordiness.
Context: ...Go versions 1.21 and 1.22. - Fiber is not compatible with net/http interfaces. This means yo...
Near line 262: Two consecutive dots
Context: ...pug etc.. Checkout our [Template](https://github...
Near line 263: This sentence should probably be started with a verb instead of the noun ‘Checkout’. If not, consider inserting a comma for better clarity.
Context: ...](https://github.com/Joker/jade) etc.. Checkout our [Template](https://github.com/gofib...
Near line 592: This expression is usually spelled with a hyphen.
Context: ...keyauth) | Adds support for key based authentication. ...
Near line 593: Make sure that ‘Use to’ is correct. For habitual actions in the past or to mean ‘accustomed to’, use “used to”.
Context: ... | Adds Rate-limiting support to Fiber. Use to limit repeated requests to public APIs ...
Near line 593: Possible missing comma found.
Context: ...repeated requests to public APIs and/or endpoints such as password reset. ...
Near line 635: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ke audit**: Conduct quality checks. * make benchmark: Benchmark code performance...
Near line 636: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...mark**: Benchmark code performance. * make coverage: Generate test coverage repo...
Near line 637: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...e**: Generate test coverage report. * make format: Automatically format code. * ...
Near line 638: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ormat**: Automatically format code. * make lint: Run lint checks. * *make test...
Near line 639: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: .... * make lint: Run lint checks. * make test: Execute all tests. * **make tid...
Near line 640: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...* make test: Execute all tests. * make tidy: Tidy dependencies. Run these c...
Near line 646: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...ractices. ## ☕ Supporters Fiber is an open source project that runs on donations to pay t...docs/api/app.md (3)
Near line 431: Did you mean “customizing”? Or maybe you should add a pronoun? In active voice, ‘allow’ + ‘to’ takes an object, usually a pronoun.
Context: ...r## NewCtxFunc NewCtxFunc allows to customize the ctx struct as we want.
go title...
Near line 516: Did you mean “registering”? Or maybe you should add a pronoun? In active voice, ‘allow’ + ‘to’ takes an object, usually a pronoun.
Context: ...traint RegisterCustomConstraint allows to register custom constraint. ```go title="Signat...
Near line 566: Did you mean “are” or “were”?
Context: ...=> Hello, World! } ``` ## Hooks Hooks is a method to return hooks ...docs/intro.md (2)
Near line 14: Often, this adverbial phrase is redundant. Consider using an alternative.
Context: ... March XX, 2024. ### Installation First of all, download and ins...
Near line 116: The preposition ‘to’ seems more likely in this position.
Context: ...POST
, etc. -path
is a virtual path on the server -func(fiber.Ctx) error
is...
Additional comments not posted (8)
.github/README.md (3)
206-206
: Update the static middleware usage to reflect the new API changes.Verification successful
The static middleware usage has been updated correctly in the main application code. The remaining occurrences of
app.Static
are confined to test files, which is acceptable for testing legacy behavior or backward compatibility.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the new static middleware usage is consistent across all examples in the repository. # Test: Search for the old static middleware usage. Expect: No occurrences of the old usage. rg --type go $'app.Static'Length of output: 425
Script:
#!/bin/bash # Description: Verify if the old static middleware usage is present in any non-test files. # Test: Search for the old static middleware usage in non-test files. Expect: No occurrences of the old usage. rg --type go --glob '!*_test.go' $'app.Static'Length of output: 45
210-210
: Ensure the new static middleware usage with prefix is correctly documented.
603-603
: Confirm the description of the static middleware in the internal middleware list.Verification successful
Description of the static middleware is accurate
The description of the static middleware in the internal middleware list matches the description in the documentation, confirming its accuracy.
docs/middleware/static.md
: "Static middleware for Fiber that serves static files such as images, CSS, and JavaScript."Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the description of the static middleware in the internal middleware list matches the new functionality. # Test: Search for the static middleware description in the documentation. Expect: Accurate description reflecting the new capabilities. rg --type md $'Static middleware for Fiber that serves static files'Length of output: 197
app.go (5)
Line range hint
1-1
: Ensure the project URL is correct.Verification successful
Project URL is correct
The project URL
https://github.com/gofiber/fiber
is correct and accessible, returning an HTTP 200 status code.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the project URL. # Test: Check if the URL is accessible. Expect: HTTP 200 status. curl -o /dev/null -s -w "%{http_code}" https://github.com/gofiber/fiberLength of output: 77
Line range hint
1-1
: Review the package description for accuracy.Verification successful
Package description is consistent
The description "Express inspired web framework written in Go" is consistent across the documentation.
docs/client/hooks.md
: Description matches.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the accuracy of the package description. # Test: Search for discrepancies in the description across documentation. Expect: Consistency. rg --type markdown "Express inspired web framework" docs/Length of output: 141
Line range hint
1-1
: Validate the use of emojis in the code comments.Verification successful
Consistent Use of Emojis in Code Comments
The use of emojis in code comments is consistent across the codebase, as evidenced by the presence of the 📌 emoji in multiple Go files.
router_test.go
router.go
group.go
register.go
app_test.go
app.go
redirect_test.go
redirect.go
prefork_test.go
path_testcases_test.go
path_test.go
path.go
mount_test.go
mount.go
listen.go
helpers_test.go
helpers.go
ctx_test.go
ctx_interface.go
ctx.go
color.go
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Validate the appropriateness of emojis in code comments. # Test: Check for the presence of emojis in other core files. Expect: Consistent use. rg "📌" --type goLength of output: 1322
Line range hint
1-1
: Review the accuracy of the version number mentioned in the comments.
Line range hint
1-1
: Confirm the memory allocation claims in the package description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- docs/middleware/static.md (1 hunks)
- middleware/static/static.go (1 hunks)
- middleware/static/static_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- middleware/static/static.go
Additional Context Used
GitHub Check Runs (1)
lint failure (3)
middleware/static/static_test.go: [failure] 130-130:
Error return value ofos.Remove
is not checked (errcheck)
middleware/static/static_test.go: [failure] 152-152:
expected-actual: need to reverse actual and expected values (testifylint)
Additional comments not posted (1)
docs/middleware/static.md (1)
16-17
: Ensure theNew
function signature is consistent with implementation.Verification successful
The
New
function signature inmiddleware/static/static.go
is consistent with the documentation. The function is defined as:func New(root string, cfg ...Config) fiber.Handler {This matches the signature mentioned in the documentation:
func New(root string, cfg ...Config) fiber.HandlerNo inconsistencies were found in the function signature across the codebase.
middleware/static/static.go: func New(root string, cfg ...Config) fiber.Handler
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the consistency of the `New` function signature across the codebase. # Test: Search for the function signature. Expect: Consistent usage across all files. ast-grep --lang go --pattern $'func New($_, $_) fiber.Handler {}'Length of output: 66
Script:
#!/bin/bash # Description: Search for the `New` function definition in Go files and verify its signature. # Find all Go files and search for the `New` function definition. # The pattern is relaxed to capture the function definition without the body. rg --glob '*.go' --pcre2 --multiline --multiline-dotall --context 5 'func New\('Length of output: 17278
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- docs/middleware/static.md (1 hunks)
- middleware/static/config.go (1 hunks)
- middleware/static/static.go (1 hunks)
- middleware/static/static_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- middleware/static/config.go
- middleware/static/static.go
Additional Context Used
GitHub Check Runs (1)
lint failure (3)
middleware/static/static_test.go: [failure] 130-130:
Error return value ofos.Remove
is not checked (errcheck)
middleware/static/static_test.go: [failure] 152-152:
expected-actual: need to reverse actual and expected values (testifylint)
Additional comments not posted (6)
docs/middleware/static.md (4)
9-11
: Clarify the default behavior of servingindex.html
.
32-34
: Consider using relative paths in examples to enhance portability.Also applies to: 59-61, 86-88
102-104
: Revise the caution note for clarity.
121-121
: Remove extra blank line for cleaner formatting.middleware/static/static_test.go (2)
130-130
: Ensure file removal errors are handled.
152-152
: Correct the order of expected and actual values in assertions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (2)
go.mod
is excluded by!**/*.mod
,!**/*.mod
go.sum
is excluded by!**/*.sum
,!**/*.sum
Files selected for processing (2)
- docs/middleware/static.md (1 hunks)
- middleware/static/static_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- middleware/static/static_test.go
Additional Context Used
Markdownlint (6)
docs/middleware/static.md (6)
114: Column: 1
Hard tabs
115: Column: 1
Hard tabs
116: Column: 1
Hard tabs
156: Column: 1
Hard tabs
157: Column: 1
Hard tabs
151: Expected: 1; Actual: 2
Multiple consecutive blank lines
Additional comments not posted (7)
docs/middleware/static.md (7)
9-11
: Clarify the default behavior of servingindex.html
.
32-34
: Review the usage of static paths in examples.
59-61
: Review the usage of static paths in examples.
86-88
: Review the usage of static paths in examples.
132-134
: Revise the caution note for clarity.
151-151
: Remove extra blank line for cleaner formatting.
156-157
: Replace hard tabs with spaces for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Outside diff range and nitpick comments (1)
docs/whats_new.md (1)
Line range hint
192-200
: Correct the spelling of "Express.js" in the documentation.- ExpressJs like + Express.js like
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- docs/whats_new.md (4 hunks)
Additional Context Used
LanguageTool (15)
docs/whats_new.md (15)
Near line 51: It looks like there is a word missing here. Did you mean “listen to config”?
Context: ...ic.md) * app.Config properties moved to listen config * DisableStartupMessage * EnablePre...
Near line 55: This adverb was used twice in the sentence. Consider removing one of them or replacing them with a synonym.
Context: ...nablePrintRoutes * ListenerNetwork -> previously Network ### new methods * RegisterCus...
Near line 66: Possible missing preposition found.
Context: ...ods * Mount -> Use app.Use() instead * ListenTLS -> Use app.Listen() with tls.Config * L...
Near line 192: The official spelling of this programming framework is “Express.js”.
Context: ... ::: ### new methods * AutoFormat -> ExpressJs like * Host -> ExpressJs like * Port ->...
Near line 193: The official spelling of this programming framework is “Express.js”.
Context: ... AutoFormat -> ExpressJs like * Host -> ExpressJs like * Port -> ExpressJs like * IsProxy...
Near line 194: The official spelling of this programming framework is “Express.js”.
Context: ...like * Host -> ExpressJs like * Port -> ExpressJs like * IsProxyTrusted * Reset * Schema ...
Near line 197: The official spelling of this programming framework is “Express.js”.
Context: ...ke * IsProxyTrusted * Reset * Schema -> ExpressJs like * SendStream -> ExpressJs like * S...
Near line 198: The official spelling of this programming framework is “Express.js”.
Context: ...chema -> ExpressJs like * SendStream -> ExpressJs like * SendString -> ExpressJs like * S...
Near line 199: The official spelling of this programming framework is “Express.js”.
Context: ...tream -> ExpressJs like * SendString -> ExpressJs like * String -> ExpressJs like * ViewB...
Near line 200: The official spelling of this programming framework is “Express.js”.
Context: ...endString -> ExpressJs like * String -> ExpressJs like * ViewBind -> instead of Bind ###...
Near line 253: Consider rephrasing this to strengthen your wording.
Context: ...::: ## 🧬 Middlewares ### CORS We've made some changes to the CORS middleware to improve its f...
Near line 261: Loose punctuation mark.
Context: ...updated fields: -Config.AllowOrigins
: Now accepts a slice of strings, each re...
Near line 262: Loose punctuation mark.
Context: ... allowed origin. -Config.AllowMethods
: Now accepts a slice of strings, each re...
Near line 263: Loose punctuation mark.
Context: ... allowed method. -Config.AllowHeaders
: Now accepts a slice of strings, each re...
Near line 264: Loose punctuation mark.
Context: ...allowed header. -Config.ExposeHeaders
: Now accepts a slice of strings, each re...
Markdownlint (57)
docs/whats_new.md (57)
49: Expected: dash; Actual: asterisk
Unordered list style
50: Expected: dash; Actual: asterisk
Unordered list style
51: Expected: dash; Actual: asterisk
Unordered list style
52: Expected: dash; Actual: asterisk
Unordered list style
53: Expected: dash; Actual: asterisk
Unordered list style
54: Expected: dash; Actual: asterisk
Unordered list style
55: Expected: dash; Actual: asterisk
Unordered list style
59: Expected: dash; Actual: asterisk
Unordered list style
60: Expected: dash; Actual: asterisk
Unordered list style
61: Expected: dash; Actual: asterisk
Unordered list style
65: Expected: dash; Actual: asterisk
Unordered list style
66: Expected: dash; Actual: asterisk
Unordered list style
67: Expected: dash; Actual: asterisk
Unordered list style
68: Expected: dash; Actual: asterisk
Unordered list style
69: Expected: dash; Actual: asterisk
Unordered list style
73: Expected: dash; Actual: asterisk
Unordered list style
74: Expected: dash; Actual: asterisk
Unordered list style
75: Expected: dash; Actual: asterisk
Unordered list style
192: Expected: dash; Actual: asterisk
Unordered list style
193: Expected: dash; Actual: asterisk
Unordered list style
194: Expected: dash; Actual: asterisk
Unordered list style
195: Expected: dash; Actual: asterisk
Unordered list style
196: Expected: dash; Actual: asterisk
Unordered list style
197: Expected: dash; Actual: asterisk
Unordered list style
198: Expected: dash; Actual: asterisk
Unordered list style
199: Expected: dash; Actual: asterisk
Unordered list style
200: Expected: dash; Actual: asterisk
Unordered list style
201: Expected: dash; Actual: asterisk
Unordered list style
205: Expected: dash; Actual: asterisk
Unordered list style
206: Expected: dash; Actual: asterisk
Unordered list style
207: Expected: dash; Actual: asterisk
Unordered list style
208: Expected: dash; Actual: asterisk
Unordered list style
209: Expected: dash; Actual: asterisk
Unordered list style
210: Expected: dash; Actual: asterisk
Unordered list style
211: Expected: dash; Actual: asterisk
Unordered list style
212: Expected: dash; Actual: asterisk
Unordered list style
213: Expected: dash; Actual: asterisk
Unordered list style
214: Expected: dash; Actual: asterisk
Unordered list style
215: Expected: dash; Actual: asterisk
Unordered list style
219: Expected: dash; Actual: asterisk
Unordered list style
220: Expected: dash; Actual: asterisk
Unordered list style
221: Expected: dash; Actual: asterisk
Unordered list style
229: Expected: 0 or 2; Actual: 1
Trailing spaces
274: Expected: 0 or 2; Actual: 1
Trailing spaces
367: Column: 1
Hard tabs
381: Column: 1
Hard tabs
189: Expected: 1; Actual: 2
Multiple consecutive blank lines
242: Expected: 1; Actual: 2
Multiple consecutive blank lines
295: Expected: 1; Actual: 2
Multiple consecutive blank lines
255: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines
258: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines
143: null
Fenced code blocks should be surrounded by blank lines
171: null
Fenced code blocks should be surrounded by blank lines
23: null
Lists should be surrounded by blank lines
256: null
Lists should be surrounded by blank lines
390: null
Files should end with a single newline character
275: null
Link fragments should be valid
Additional comments not posted (2)
docs/whats_new.md (2)
50-50
: Clarify the transition ofStatic
tostatic middleware
.Verification successful
The transition from
Static
tostatic middleware
is clearly documented in the relevant files.
docs/whats_new.md
provides detailed information about the removal ofStatic
and its replacement withstatic middleware
.docs/middleware/static.md
explains the functionality of thestatic middleware
.docs/intro.md
references thestatic middleware
for more information.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the transition from `Static` to `static middleware` is clearly documented in all relevant files. # Test: Search for mentions of `Static` and `static middleware`. Expect: Clear documentation on the transition. rg --type md 'Static|static middleware'Length of output: 1323
274-275
: Ensure the link to the static middleware documentation is valid.Verification successful
The link to the static middleware documentation is valid.
- The
middleware
directory exists.- The file
docs/middleware/static.md
exists.- References to
static.md
in the documentation are consistent.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the link to the static middleware documentation is valid. # Test: Check if the link to `static.md` is reachable and correct. if [ -f ./middleware/static.md ]; then echo "Link is valid." else echo "Link is invalid." fiLength of output: 78
Script:
#!/bin/bash # Description: Verify the existence of the `middleware` directory and search for files related to `static`. # Check if the `middleware` directory exists. if [ -d ./middleware ]; then echo "middleware directory exists." else echo "middleware directory does not exist." fi # Search for files related to `static` within the repository. echo "Searching for files related to 'static'..." fd static # Search for references to `static.md` in the documentation. echo "Searching for references to 'static.md' in the documentation..." rg 'static.md'Length of output: 906
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (2)
go.mod
is excluded by!**/*.mod
,!**/*.mod
go.sum
is excluded by!**/*.sum
,!**/*.sum
Files selected for processing (3)
- docs/middleware/static.md (1 hunks)
- docs/whats_new.md (4 hunks)
- middleware/static/static_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- middleware/static/static_test.go
Additional Context Used
Markdownlint (62)
docs/middleware/static.md (5)
114: Column: 1
Hard tabs
115: Column: 1
Hard tabs
116: Column: 1
Hard tabs
155: Column: 1
Hard tabs
156: Column: 1
Hard tabsdocs/whats_new.md (57)
49: Expected: dash; Actual: asterisk
Unordered list style
50: Expected: dash; Actual: asterisk
Unordered list style
51: Expected: dash; Actual: asterisk
Unordered list style
52: Expected: dash; Actual: asterisk
Unordered list style
53: Expected: dash; Actual: asterisk
Unordered list style
54: Expected: dash; Actual: asterisk
Unordered list style
55: Expected: dash; Actual: asterisk
Unordered list style
59: Expected: dash; Actual: asterisk
Unordered list style
60: Expected: dash; Actual: asterisk
Unordered list style
61: Expected: dash; Actual: asterisk
Unordered list style
65: Expected: dash; Actual: asterisk
Unordered list style
66: Expected: dash; Actual: asterisk
Unordered list style
67: Expected: dash; Actual: asterisk
Unordered list style
68: Expected: dash; Actual: asterisk
Unordered list style
69: Expected: dash; Actual: asterisk
Unordered list style
73: Expected: dash; Actual: asterisk
Unordered list style
74: Expected: dash; Actual: asterisk
Unordered list style
75: Expected: dash; Actual: asterisk
Unordered list style
192: Expected: dash; Actual: asterisk
Unordered list style
193: Expected: dash; Actual: asterisk
Unordered list style
194: Expected: dash; Actual: asterisk
Unordered list style
195: Expected: dash; Actual: asterisk
Unordered list style
196: Expected: dash; Actual: asterisk
Unordered list style
197: Expected: dash; Actual: asterisk
Unordered list style
198: Expected: dash; Actual: asterisk
Unordered list style
199: Expected: dash; Actual: asterisk
Unordered list style
200: Expected: dash; Actual: asterisk
Unordered list style
201: Expected: dash; Actual: asterisk
Unordered list style
205: Expected: dash; Actual: asterisk
Unordered list style
206: Expected: dash; Actual: asterisk
Unordered list style
207: Expected: dash; Actual: asterisk
Unordered list style
208: Expected: dash; Actual: asterisk
Unordered list style
209: Expected: dash; Actual: asterisk
Unordered list style
210: Expected: dash; Actual: asterisk
Unordered list style
211: Expected: dash; Actual: asterisk
Unordered list style
212: Expected: dash; Actual: asterisk
Unordered list style
213: Expected: dash; Actual: asterisk
Unordered list style
214: Expected: dash; Actual: asterisk
Unordered list style
215: Expected: dash; Actual: asterisk
Unordered list style
219: Expected: dash; Actual: asterisk
Unordered list style
220: Expected: dash; Actual: asterisk
Unordered list style
221: Expected: dash; Actual: asterisk
Unordered list style
229: Expected: 0 or 2; Actual: 1
Trailing spaces
274: Expected: 0 or 2; Actual: 1
Trailing spaces
367: Column: 1
Hard tabs
381: Column: 1
Hard tabs
189: Expected: 1; Actual: 2
Multiple consecutive blank lines
242: Expected: 1; Actual: 2
Multiple consecutive blank lines
295: Expected: 1; Actual: 2
Multiple consecutive blank lines
255: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines
258: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines
143: null
Fenced code blocks should be surrounded by blank lines
171: null
Fenced code blocks should be surrounded by blank lines
23: null
Lists should be surrounded by blank lines
256: null
Lists should be surrounded by blank lines
390: null
Files should end with a single newline character
275: null
Link fragments should be valid
Additional comments not posted (4)
docs/middleware/static.md (4)
9-11
: Clarify the default behavior of servingindex.html
.
32-34
: Consider using environment variables for static file paths in examples.
132-134
: Revise the caution note for clarity.
155-156
: Replace hard tabs with spaces for consistency.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3006 +/- ##
==========================================
+ Coverage 82.78% 82.84% +0.06%
==========================================
Files 115 115
Lines 8409 8230 -179
==========================================
- Hits 6961 6818 -143
+ Misses 1109 1083 -26
+ Partials 339 329 -10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
almost perfect just a few little things to adjust
Co-authored-by: RW <rene@gofiber.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (2)
go.mod
is excluded by!**/*.mod
,!**/*.mod
go.sum
is excluded by!**/*.sum
,!**/*.sum
Files selected for processing (1)
- .github/README.md (4 hunks)
Additional Context Used
LanguageTool (12)
.github/README.md (12)
Near line 124: Consider using “incompatible” to avoid wordiness.
Context: ...Go versions 1.21 and 1.22. - Fiber is not compatible with net/http interfaces. This means yo...
Near line 262: Two consecutive dots
Context: ...pug etc.. Checkout our [Template](https://github...
Near line 263: This sentence should probably be started with a verb instead of the noun ‘Checkout’. If not, consider inserting a comma for better clarity.
Context: ...](https://github.com/Joker/jade) etc.. Checkout our [Template](https://github.com/gofib...
Near line 592: This expression is usually spelled with a hyphen.
Context: ...keyauth) | Adds support for key based authentication. ...
Near line 593: Make sure that ‘Use to’ is correct. For habitual actions in the past or to mean ‘accustomed to’, use “used to”.
Context: ... | Adds Rate-limiting support to Fiber. Use to limit repeated requests to public APIs ...
Near line 635: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ke audit**: Conduct quality checks. * make benchmark: Benchmark code performance...
Near line 636: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...mark**: Benchmark code performance. * make coverage: Generate test coverage repo...
Near line 637: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...e**: Generate test coverage report. * make format: Automatically format code. * ...
Near line 638: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ormat**: Automatically format code. * make lint: Run lint checks. * *make test...
Near line 639: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: .... * make lint: Run lint checks. * make test: Execute all tests. * **make tid...
Near line 640: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...* make test: Execute all tests. * make tidy: Tidy dependencies. Run these c...
Near line 646: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...ractices. ## ☕ Supporters Fiber is an open source project that runs on donations to pay t...
Markdownlint (36)
.github/README.md (36)
130: Expected: h3; Actual: h4
Heading levels should only increment by one level at a time
633: Expected: dash; Actual: asterisk
Unordered list style
634: Expected: dash; Actual: asterisk
Unordered list style
635: Expected: dash; Actual: asterisk
Unordered list style
636: Expected: dash; Actual: asterisk
Unordered list style
637: Expected: dash; Actual: asterisk
Unordered list style
638: Expected: dash; Actual: asterisk
Unordered list style
639: Expected: dash; Actual: asterisk
Unordered list style
640: Expected: dash; Actual: asterisk
Unordered list style
15: Expected: 0 or 2; Actual: 1
Trailing spaces
60: Expected: 0 or 2; Actual: 1
Trailing spaces
10: null
Images should have alternate text (alt text)
13: null
Images should have alternate text (alt text)
19: null
Images should have alternate text (alt text)
22: null
Images should have alternate text (alt text)
25: null
Images should have alternate text (alt text)
93: null
Images should have alternate text (alt text)
94: null
Images should have alternate text (alt text)
650: null
Images should have alternate text (alt text)
651: null
Images should have alternate text (alt text)
652: null
Images should have alternate text (alt text)
653: null
Images should have alternate text (alt text)
654: null
Images should have alternate text (alt text)
655: null
Images should have alternate text (alt text)
656: null
Images should have alternate text (alt text)
657: null
Images should have alternate text (alt text)
658: null
Images should have alternate text (alt text)
659: null
Images should have alternate text (alt text)
660: null
Images should have alternate text (alt text)
661: null
Images should have alternate text (alt text)
662: null
Images should have alternate text (alt text)
663: null
Images should have alternate text (alt text)
664: null
Images should have alternate text (alt text)
665: null
Images should have alternate text (alt text)
666: null
Images should have alternate text (alt text)
667: null
Images should have alternate text (alt text)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, you've been doing a good job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- middleware/static/static_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- middleware/static/static_test.go
aab49ec
to
db1537a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (7)
- constants.go (2 hunks)
- docs/api/constants.md (1 hunks)
- docs/middleware/static.md (1 hunks)
- docs/whats_new.md (4 hunks)
- middleware/static/config.go (1 hunks)
- middleware/static/static.go (1 hunks)
- middleware/static/static_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (4)
- constants.go
- docs/middleware/static.md
- middleware/static/config.go
- middleware/static/static_test.go
Additional Context Used
Markdownlint (296)
docs/api/constants.md (242)
29: Column: 1
Hard tabs
30: Column: 1
Hard tabs
31: Column: 1
Hard tabs
32: Column: 1
Hard tabs
33: Column: 1
Hard tabs
34: Column: 1
Hard tabs
36: Column: 1
Hard tabs
37: Column: 1
Hard tabs
38: Column: 1
Hard tabs
39: Column: 1
Hard tabs
41: Column: 1
Hard tabs
42: Column: 1
Hard tabs
43: Column: 1
Hard tabs
44: Column: 1
Hard tabs
45: Column: 1
Hard tabs
46: Column: 1
Hard tabs
47: Column: 1
Hard tabs
48: Column: 1
Hard tabs
55: Column: 1
Hard tabs
56: Column: 1
Hard tabs
57: Column: 1
Hard tabs
58: Column: 1
Hard tabs
59: Column: 1
Hard tabs
60: Column: 1
Hard tabs
61: Column: 1
Hard tabs
62: Column: 1
Hard tabs
63: Column: 1
Hard tabs
64: Column: 1
Hard tabs
65: Column: 1
Hard tabs
66: Column: 1
Hard tabs
67: Column: 1
Hard tabs
68: Column: 1
Hard tabs
69: Column: 1
Hard tabs
70: Column: 1
Hard tabs
71: Column: 1
Hard tabs
72: Column: 1
Hard tabs
73: Column: 1
Hard tabs
74: Column: 1
Hard tabs
75: Column: 1
Hard tabs
76: Column: 1
Hard tabs
77: Column: 1
Hard tabs
78: Column: 1
Hard tabs
79: Column: 1
Hard tabs
80: Column: 1
Hard tabs
81: Column: 1
Hard tabs
82: Column: 1
Hard tabs
83: Column: 1
Hard tabs
84: Column: 1
Hard tabs
85: Column: 1
Hard tabs
86: Column: 1
Hard tabs
87: Column: 1
Hard tabs
88: Column: 1
Hard tabs
89: Column: 1
Hard tabs
90: Column: 1
Hard tabs
91: Column: 1
Hard tabs
92: Column: 1
Hard tabs
93: Column: 1
Hard tabs
94: Column: 1
Hard tabs
95: Column: 1
Hard tabs
96: Column: 1
Hard tabs
97: Column: 1
Hard tabs
98: Column: 1
Hard tabs
99: Column: 1
Hard tabs
100: Column: 1
Hard tabs
101: Column: 1
Hard tabs
102: Column: 1
Hard tabs
103: Column: 1
Hard tabs
104: Column: 1
Hard tabs
105: Column: 1
Hard tabs
106: Column: 1
Hard tabs
107: Column: 1
Hard tabs
108: Column: 1
Hard tabs
109: Column: 1
Hard tabs
110: Column: 1
Hard tabs
111: Column: 1
Hard tabs
112: Column: 1
Hard tabs
113: Column: 1
Hard tabs
114: Column: 1
Hard tabs
115: Column: 1
Hard tabs
116: Column: 1
Hard tabs
124: Column: 1
Hard tabs
125: Column: 1
Hard tabs
126: Column: 1
Hard tabs
127: Column: 1
Hard tabs
128: Column: 1
Hard tabs
129: Column: 1
Hard tabs
130: Column: 1
Hard tabs
131: Column: 1
Hard tabs
132: Column: 1
Hard tabs
133: Column: 1
Hard tabs
134: Column: 1
Hard tabs
135: Column: 1
Hard tabs
136: Column: 1
Hard tabs
137: Column: 1
Hard tabs
138: Column: 1
Hard tabs
139: Column: 1
Hard tabs
140: Column: 1
Hard tabs
141: Column: 1
Hard tabs
142: Column: 1
Hard tabs
143: Column: 1
Hard tabs
144: Column: 1
Hard tabs
145: Column: 1
Hard tabs
146: Column: 1
Hard tabs
147: Column: 1
Hard tabs
148: Column: 1
Hard tabs
149: Column: 1
Hard tabs
150: Column: 1
Hard tabs
151: Column: 1
Hard tabs
152: Column: 1
Hard tabs
153: Column: 1
Hard tabs
154: Column: 1
Hard tabs
155: Column: 1
Hard tabs
156: Column: 1
Hard tabs
157: Column: 1
Hard tabs
158: Column: 1
Hard tabs
159: Column: 1
Hard tabs
160: Column: 1
Hard tabs
161: Column: 1
Hard tabs
162: Column: 1
Hard tabs
163: Column: 1
Hard tabs
171: Column: 1
Hard tabs
172: Column: 1
Hard tabs
173: Column: 1
Hard tabs
174: Column: 1
Hard tabs
175: Column: 1
Hard tabs
176: Column: 1
Hard tabs
177: Column: 1
Hard tabs
178: Column: 1
Hard tabs
179: Column: 1
Hard tabs
180: Column: 1
Hard tabs
181: Column: 1
Hard tabs
182: Column: 1
Hard tabs
183: Column: 1
Hard tabs
184: Column: 1
Hard tabs
185: Column: 1
Hard tabs
186: Column: 1
Hard tabs
187: Column: 1
Hard tabs
188: Column: 1
Hard tabs
189: Column: 1
Hard tabs
190: Column: 1
Hard tabs
191: Column: 1
Hard tabs
192: Column: 1
Hard tabs
193: Column: 1
Hard tabs
194: Column: 1
Hard tabs
195: Column: 1
Hard tabs
196: Column: 1
Hard tabs
197: Column: 1
Hard tabs
198: Column: 1
Hard tabs
199: Column: 1
Hard tabs
200: Column: 1
Hard tabs
201: Column: 1
Hard tabs
202: Column: 1
Hard tabs
203: Column: 1
Hard tabs
204: Column: 1
Hard tabs
205: Column: 1
Hard tabs
206: Column: 1
Hard tabs
207: Column: 1
Hard tabs
208: Column: 1
Hard tabs
209: Column: 1
Hard tabs
210: Column: 1
Hard tabs
211: Column: 1
Hard tabs
212: Column: 1
Hard tabs
213: Column: 1
Hard tabs
214: Column: 1
Hard tabs
215: Column: 1
Hard tabs
216: Column: 1
Hard tabs
217: Column: 1
Hard tabs
218: Column: 1
Hard tabs
219: Column: 1
Hard tabs
220: Column: 1
Hard tabs
221: Column: 1
Hard tabs
222: Column: 1
Hard tabs
223: Column: 1
Hard tabs
224: Column: 1
Hard tabs
225: Column: 1
Hard tabs
226: Column: 1
Hard tabs
227: Column: 1
Hard tabs
228: Column: 1
Hard tabs
229: Column: 1
Hard tabs
230: Column: 1
Hard tabs
231: Column: 1
Hard tabs
232: Column: 1
Hard tabs
233: Column: 1
Hard tabs
234: Column: 1
Hard tabs
235: Column: 1
Hard tabs
236: Column: 1
Hard tabs
237: Column: 1
Hard tabs
238: Column: 1
Hard tabs
239: Column: 1
Hard tabs
240: Column: 1
Hard tabs
241: Column: 1
Hard tabs
242: Column: 1
Hard tabs
243: Column: 1
Hard tabs
244: Column: 1
Hard tabs
245: Column: 1
Hard tabs
246: Column: 1
Hard tabs
247: Column: 1
Hard tabs
248: Column: 1
Hard tabs
249: Column: 1
Hard tabs
250: Column: 1
Hard tabs
251: Column: 1
Hard tabs
252: Column: 1
Hard tabs
253: Column: 1
Hard tabs
254: Column: 1
Hard tabs
255: Column: 1
Hard tabs
256: Column: 1
Hard tabs
257: Column: 1
Hard tabs
258: Column: 1
Hard tabs
259: Column: 1
Hard tabs
260: Column: 1
Hard tabs
261: Column: 1
Hard tabs
262: Column: 1
Hard tabs
263: Column: 1
Hard tabs
264: Column: 1
Hard tabs
265: Column: 1
Hard tabs
266: Column: 1
Hard tabs
267: Column: 1
Hard tabs
268: Column: 1
Hard tabs
269: Column: 1
Hard tabs
270: Column: 1
Hard tabs
271: Column: 1
Hard tabs
272: Column: 1
Hard tabs
273: Column: 1
Hard tabs
274: Column: 1
Hard tabs
275: Column: 1
Hard tabs
276: Column: 1
Hard tabs
277: Column: 1
Hard tabs
278: Column: 1
Hard tabs
279: Column: 1
Hard tabs
280: Column: 1
Hard tabs
281: Column: 1
Hard tabs
282: Column: 1
Hard tabs
283: Column: 1
Hard tabs
284: Column: 1
Hard tabs
285: Column: 1
Hard tabs
286: Column: 1
Hard tabs
287: Column: 1
Hard tabs
288: Column: 1
Hard tabs
289: Column: 1
Hard tabs
290: Column: 1
Hard tabs
291: Column: 1
Hard tabs
292: Column: 1
Hard tabsdocs/whats_new.md (54)
49: Expected: dash; Actual: asterisk
Unordered list style
50: Expected: dash; Actual: asterisk
Unordered list style
51: Expected: dash; Actual: asterisk
Unordered list style
52: Expected: dash; Actual: asterisk
Unordered list style
53: Expected: dash; Actual: asterisk
Unordered list style
54: Expected: dash; Actual: asterisk
Unordered list style
55: Expected: dash; Actual: asterisk
Unordered list style
59: Expected: dash; Actual: asterisk
Unordered list style
60: Expected: dash; Actual: asterisk
Unordered list style
61: Expected: dash; Actual: asterisk
Unordered list style
65: Expected: dash; Actual: asterisk
Unordered list style
66: Expected: dash; Actual: asterisk
Unordered list style
67: Expected: dash; Actual: asterisk
Unordered list style
68: Expected: dash; Actual: asterisk
Unordered list style
69: Expected: dash; Actual: asterisk
Unordered list style
73: Expected: dash; Actual: asterisk
Unordered list style
74: Expected: dash; Actual: asterisk
Unordered list style
75: Expected: dash; Actual: asterisk
Unordered list style
192: Expected: dash; Actual: asterisk
Unordered list style
193: Expected: dash; Actual: asterisk
Unordered list style
194: Expected: dash; Actual: asterisk
Unordered list style
195: Expected: dash; Actual: asterisk
Unordered list style
196: Expected: dash; Actual: asterisk
Unordered list style
197: Expected: dash; Actual: asterisk
Unordered list style
198: Expected: dash; Actual: asterisk
Unordered list style
199: Expected: dash; Actual: asterisk
Unordered list style
200: Expected: dash; Actual: asterisk
Unordered list style
201: Expected: dash; Actual: asterisk
Unordered list style
205: Expected: dash; Actual: asterisk
Unordered list style
206: Expected: dash; Actual: asterisk
Unordered list style
207: Expected: dash; Actual: asterisk
Unordered list style
208: Expected: dash; Actual: asterisk
Unordered list style
209: Expected: dash; Actual: asterisk
Unordered list style
210: Expected: dash; Actual: asterisk
Unordered list style
211: Expected: dash; Actual: asterisk
Unordered list style
212: Expected: dash; Actual: asterisk
Unordered list style
213: Expected: dash; Actual: asterisk
Unordered list style
214: Expected: dash; Actual: asterisk
Unordered list style
215: Expected: dash; Actual: asterisk
Unordered list style
219: Expected: dash; Actual: asterisk
Unordered list style
220: Expected: dash; Actual: asterisk
Unordered list style
221: Expected: dash; Actual: asterisk
Unordered list style
229: Expected: 0 or 2; Actual: 1
Trailing spaces
274: Expected: 0 or 2; Actual: 1
Trailing spaces
189: Expected: 1; Actual: 2
Multiple consecutive blank lines
242: Expected: 1; Actual: 2
Multiple consecutive blank lines
295: Expected: 1; Actual: 2
Multiple consecutive blank lines
255: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines
258: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines
143: null
Fenced code blocks should be surrounded by blank lines
171: null
Fenced code blocks should be surrounded by blank lines
23: null
Lists should be surrounded by blank lines
256: null
Lists should be surrounded by blank lines
390: null
Files should end with a single newline character
GitHub Check Runs (1)
codecov/patch success (3)
middleware/static/static.go: [warning] 42-42: middleware/static/static.go#L42
Added line #L42 was not covered by tests
middleware/static/static.go: [warning] 83-83: middleware/static/static.go#L83
Added line #L83 was not covered by tests
middleware/static/static.go: [warning] 171-171: middleware/static/static.go#L171
Added line #L171 was not covered by tests
Additional comments not posted (4)
middleware/static/static.go (3)
42-42
: Ensure this line is covered by tests.Verification successful
The line
return c.Next()
inmiddleware/static/static.go
is covered by tests.
- The following test files contain references to
c.Next()
:
./router_test.go
./app_test.go
./mount_test.go
./middleware/static/static_test.go
./middleware/requestid/requestid_test.go
./middleware/idempotency/idempotency_test.go
./middleware/earlydata/earlydata_test.go
./ctx_test.go
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify coverage for line 42 in static.go # Test: Search for test cases covering line 42. Expect: At least one test case. rg --type go $'if method != fiber.MethodGet && method != fiber.MethodHead {'Length of output: 261
Script:
#!/bin/bash # Description: Verify coverage for line 42 in static.go # Locate the test files that might cover the middleware/static/static.go file test_files=$(rg --files-with-matches --type go 'middleware/static/static.go') # Check if any of these test files contain references to the `Next` method, which would indicate coverage for test_file in $test_files; do echo "Checking $test_file for coverage of c.Next()" rg 'c\.Next\(\)' "$test_file" doneLength of output: 78
Script:
#!/bin/bash # Description: Verify coverage for line 42 in static.go # Locate all Go test files in the repository test_files=$(fd --type f --extension go --exec rg --files-with-matches 'func Test' {} +) # Check if any of these test files contain references to the `Next` method, which would indicate coverage for test_file in $test_files; do echo "Checking $test_file for coverage of c.Next()" rg 'c\.Next\(\)' "$test_file" doneLength of output: 23807
83-83
: Ensure this line is covered by tests.
171-171
: Ensure this line is covered by tests.docs/api/constants.md (1)
32-33
: The addition of new MIME types and their charset variants aligns well with the PR objectives and enhances the framework's capability to handle more content types. Good job on maintaining consistency with existing naming conventions.Also applies to: 44-45
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Outside diff range and nitpick comments (1)
docs/api/constants.md (1)
Line range hint
29-292
: Replace hard tabs with spaces to maintain consistency in indentation style.
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (7)
- constants.go (2 hunks)
- docs/api/constants.md (1 hunks)
- docs/middleware/static.md (1 hunks)
- docs/whats_new.md (4 hunks)
- middleware/static/config.go (1 hunks)
- middleware/static/static.go (1 hunks)
- middleware/static/static_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (4)
- constants.go
- docs/middleware/static.md
- middleware/static/config.go
- middleware/static/static_test.go
Additional Context Used
Markdownlint (296)
docs/api/constants.md (242)
29: Column: 1
Hard tabs
30: Column: 1
Hard tabs
31: Column: 1
Hard tabs
32: Column: 1
Hard tabs
33: Column: 1
Hard tabs
34: Column: 1
Hard tabs
36: Column: 1
Hard tabs
37: Column: 1
Hard tabs
38: Column: 1
Hard tabs
39: Column: 1
Hard tabs
41: Column: 1
Hard tabs
42: Column: 1
Hard tabs
43: Column: 1
Hard tabs
44: Column: 1
Hard tabs
45: Column: 1
Hard tabs
46: Column: 1
Hard tabs
47: Column: 1
Hard tabs
48: Column: 1
Hard tabs
55: Column: 1
Hard tabs
56: Column: 1
Hard tabs
57: Column: 1
Hard tabs
58: Column: 1
Hard tabs
59: Column: 1
Hard tabs
60: Column: 1
Hard tabs
61: Column: 1
Hard tabs
62: Column: 1
Hard tabs
63: Column: 1
Hard tabs
64: Column: 1
Hard tabs
65: Column: 1
Hard tabs
66: Column: 1
Hard tabs
67: Column: 1
Hard tabs
68: Column: 1
Hard tabs
69: Column: 1
Hard tabs
70: Column: 1
Hard tabs
71: Column: 1
Hard tabs
72: Column: 1
Hard tabs
73: Column: 1
Hard tabs
74: Column: 1
Hard tabs
75: Column: 1
Hard tabs
76: Column: 1
Hard tabs
77: Column: 1
Hard tabs
78: Column: 1
Hard tabs
79: Column: 1
Hard tabs
80: Column: 1
Hard tabs
81: Column: 1
Hard tabs
82: Column: 1
Hard tabs
83: Column: 1
Hard tabs
84: Column: 1
Hard tabs
85: Column: 1
Hard tabs
86: Column: 1
Hard tabs
87: Column: 1
Hard tabs
88: Column: 1
Hard tabs
89: Column: 1
Hard tabs
90: Column: 1
Hard tabs
91: Column: 1
Hard tabs
92: Column: 1
Hard tabs
93: Column: 1
Hard tabs
94: Column: 1
Hard tabs
95: Column: 1
Hard tabs
96: Column: 1
Hard tabs
97: Column: 1
Hard tabs
98: Column: 1
Hard tabs
99: Column: 1
Hard tabs
100: Column: 1
Hard tabs
101: Column: 1
Hard tabs
102: Column: 1
Hard tabs
103: Column: 1
Hard tabs
104: Column: 1
Hard tabs
105: Column: 1
Hard tabs
106: Column: 1
Hard tabs
107: Column: 1
Hard tabs
108: Column: 1
Hard tabs
109: Column: 1
Hard tabs
110: Column: 1
Hard tabs
111: Column: 1
Hard tabs
112: Column: 1
Hard tabs
113: Column: 1
Hard tabs
114: Column: 1
Hard tabs
115: Column: 1
Hard tabs
116: Column: 1
Hard tabs
124: Column: 1
Hard tabs
125: Column: 1
Hard tabs
126: Column: 1
Hard tabs
127: Column: 1
Hard tabs
128: Column: 1
Hard tabs
129: Column: 1
Hard tabs
130: Column: 1
Hard tabs
131: Column: 1
Hard tabs
132: Column: 1
Hard tabs
133: Column: 1
Hard tabs
134: Column: 1
Hard tabs
135: Column: 1
Hard tabs
136: Column: 1
Hard tabs
137: Column: 1
Hard tabs
138: Column: 1
Hard tabs
139: Column: 1
Hard tabs
140: Column: 1
Hard tabs
141: Column: 1
Hard tabs
142: Column: 1
Hard tabs
143: Column: 1
Hard tabs
144: Column: 1
Hard tabs
145: Column: 1
Hard tabs
146: Column: 1
Hard tabs
147: Column: 1
Hard tabs
148: Column: 1
Hard tabs
149: Column: 1
Hard tabs
150: Column: 1
Hard tabs
151: Column: 1
Hard tabs
152: Column: 1
Hard tabs
153: Column: 1
Hard tabs
154: Column: 1
Hard tabs
155: Column: 1
Hard tabs
156: Column: 1
Hard tabs
157: Column: 1
Hard tabs
158: Column: 1
Hard tabs
159: Column: 1
Hard tabs
160: Column: 1
Hard tabs
161: Column: 1
Hard tabs
162: Column: 1
Hard tabs
163: Column: 1
Hard tabs
171: Column: 1
Hard tabs
172: Column: 1
Hard tabs
173: Column: 1
Hard tabs
174: Column: 1
Hard tabs
175: Column: 1
Hard tabs
176: Column: 1
Hard tabs
177: Column: 1
Hard tabs
178: Column: 1
Hard tabs
179: Column: 1
Hard tabs
180: Column: 1
Hard tabs
181: Column: 1
Hard tabs
182: Column: 1
Hard tabs
183: Column: 1
Hard tabs
184: Column: 1
Hard tabs
185: Column: 1
Hard tabs
186: Column: 1
Hard tabs
187: Column: 1
Hard tabs
188: Column: 1
Hard tabs
189: Column: 1
Hard tabs
190: Column: 1
Hard tabs
191: Column: 1
Hard tabs
192: Column: 1
Hard tabs
193: Column: 1
Hard tabs
194: Column: 1
Hard tabs
195: Column: 1
Hard tabs
196: Column: 1
Hard tabs
197: Column: 1
Hard tabs
198: Column: 1
Hard tabs
199: Column: 1
Hard tabs
200: Column: 1
Hard tabs
201: Column: 1
Hard tabs
202: Column: 1
Hard tabs
203: Column: 1
Hard tabs
204: Column: 1
Hard tabs
205: Column: 1
Hard tabs
206: Column: 1
Hard tabs
207: Column: 1
Hard tabs
208: Column: 1
Hard tabs
209: Column: 1
Hard tabs
210: Column: 1
Hard tabs
211: Column: 1
Hard tabs
212: Column: 1
Hard tabs
213: Column: 1
Hard tabs
214: Column: 1
Hard tabs
215: Column: 1
Hard tabs
216: Column: 1
Hard tabs
217: Column: 1
Hard tabs
218: Column: 1
Hard tabs
219: Column: 1
Hard tabs
220: Column: 1
Hard tabs
221: Column: 1
Hard tabs
222: Column: 1
Hard tabs
223: Column: 1
Hard tabs
224: Column: 1
Hard tabs
225: Column: 1
Hard tabs
226: Column: 1
Hard tabs
227: Column: 1
Hard tabs
228: Column: 1
Hard tabs
229: Column: 1
Hard tabs
230: Column: 1
Hard tabs
231: Column: 1
Hard tabs
232: Column: 1
Hard tabs
233: Column: 1
Hard tabs
234: Column: 1
Hard tabs
235: Column: 1
Hard tabs
236: Column: 1
Hard tabs
237: Column: 1
Hard tabs
238: Column: 1
Hard tabs
239: Column: 1
Hard tabs
240: Column: 1
Hard tabs
241: Column: 1
Hard tabs
242: Column: 1
Hard tabs
243: Column: 1
Hard tabs
244: Column: 1
Hard tabs
245: Column: 1
Hard tabs
246: Column: 1
Hard tabs
247: Column: 1
Hard tabs
248: Column: 1
Hard tabs
249: Column: 1
Hard tabs
250: Column: 1
Hard tabs
251: Column: 1
Hard tabs
252: Column: 1
Hard tabs
253: Column: 1
Hard tabs
254: Column: 1
Hard tabs
255: Column: 1
Hard tabs
256: Column: 1
Hard tabs
257: Column: 1
Hard tabs
258: Column: 1
Hard tabs
259: Column: 1
Hard tabs
260: Column: 1
Hard tabs
261: Column: 1
Hard tabs
262: Column: 1
Hard tabs
263: Column: 1
Hard tabs
264: Column: 1
Hard tabs
265: Column: 1
Hard tabs
266: Column: 1
Hard tabs
267: Column: 1
Hard tabs
268: Column: 1
Hard tabs
269: Column: 1
Hard tabs
270: Column: 1
Hard tabs
271: Column: 1
Hard tabs
272: Column: 1
Hard tabs
273: Column: 1
Hard tabs
274: Column: 1
Hard tabs
275: Column: 1
Hard tabs
276: Column: 1
Hard tabs
277: Column: 1
Hard tabs
278: Column: 1
Hard tabs
279: Column: 1
Hard tabs
280: Column: 1
Hard tabs
281: Column: 1
Hard tabs
282: Column: 1
Hard tabs
283: Column: 1
Hard tabs
284: Column: 1
Hard tabs
285: Column: 1
Hard tabs
286: Column: 1
Hard tabs
287: Column: 1
Hard tabs
288: Column: 1
Hard tabs
289: Column: 1
Hard tabs
290: Column: 1
Hard tabs
291: Column: 1
Hard tabs
292: Column: 1
Hard tabsdocs/whats_new.md (54)
49: Expected: dash; Actual: asterisk
Unordered list style
50: Expected: dash; Actual: asterisk
Unordered list style
51: Expected: dash; Actual: asterisk
Unordered list style
52: Expected: dash; Actual: asterisk
Unordered list style
53: Expected: dash; Actual: asterisk
Unordered list style
54: Expected: dash; Actual: asterisk
Unordered list style
55: Expected: dash; Actual: asterisk
Unordered list style
59: Expected: dash; Actual: asterisk
Unordered list style
60: Expected: dash; Actual: asterisk
Unordered list style
61: Expected: dash; Actual: asterisk
Unordered list style
65: Expected: dash; Actual: asterisk
Unordered list style
66: Expected: dash; Actual: asterisk
Unordered list style
67: Expected: dash; Actual: asterisk
Unordered list style
68: Expected: dash; Actual: asterisk
Unordered list style
69: Expected: dash; Actual: asterisk
Unordered list style
73: Expected: dash; Actual: asterisk
Unordered list style
74: Expected: dash; Actual: asterisk
Unordered list style
75: Expected: dash; Actual: asterisk
Unordered list style
192: Expected: dash; Actual: asterisk
Unordered list style
193: Expected: dash; Actual: asterisk
Unordered list style
194: Expected: dash; Actual: asterisk
Unordered list style
195: Expected: dash; Actual: asterisk
Unordered list style
196: Expected: dash; Actual: asterisk
Unordered list style
197: Expected: dash; Actual: asterisk
Unordered list style
198: Expected: dash; Actual: asterisk
Unordered list style
199: Expected: dash; Actual: asterisk
Unordered list style
200: Expected: dash; Actual: asterisk
Unordered list style
201: Expected: dash; Actual: asterisk
Unordered list style
205: Expected: dash; Actual: asterisk
Unordered list style
206: Expected: dash; Actual: asterisk
Unordered list style
207: Expected: dash; Actual: asterisk
Unordered list style
208: Expected: dash; Actual: asterisk
Unordered list style
209: Expected: dash; Actual: asterisk
Unordered list style
210: Expected: dash; Actual: asterisk
Unordered list style
211: Expected: dash; Actual: asterisk
Unordered list style
212: Expected: dash; Actual: asterisk
Unordered list style
213: Expected: dash; Actual: asterisk
Unordered list style
214: Expected: dash; Actual: asterisk
Unordered list style
215: Expected: dash; Actual: asterisk
Unordered list style
219: Expected: dash; Actual: asterisk
Unordered list style
220: Expected: dash; Actual: asterisk
Unordered list style
221: Expected: dash; Actual: asterisk
Unordered list style
229: Expected: 0 or 2; Actual: 1
Trailing spaces
274: Expected: 0 or 2; Actual: 1
Trailing spaces
189: Expected: 1; Actual: 2
Multiple consecutive blank lines
242: Expected: 1; Actual: 2
Multiple consecutive blank lines
295: Expected: 1; Actual: 2
Multiple consecutive blank lines
255: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines
258: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines
143: null
Fenced code blocks should be surrounded by blank lines
171: null
Fenced code blocks should be surrounded by blank lines
23: null
Lists should be surrounded by blank lines
256: null
Lists should be surrounded by blank lines
390: null
Files should end with a single newline character
GitHub Check Runs (1)
codecov/patch success (3)
middleware/static/static.go: [warning] 42-42: middleware/static/static.go#L42
Added line #L42 was not covered by tests
middleware/static/static.go: [warning] 83-83: middleware/static/static.go#L83
Added line #L83 was not covered by tests
middleware/static/static.go: [warning] 171-171: middleware/static/static.go#L171
Added line #L171 was not covered by tests
Additional comments not posted (3)
middleware/static/static.go (2)
42-42
: Ensure this line is covered by tests as it handles method filtering logic.
171-171
: Ensure this line is covered by tests as it handles error scenarios in file status checking.docs/api/constants.md (1)
33-33
: New MIME types for CSS have been added correctly.Also applies to: 45-45
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- docs/middleware/static.md (1 hunks)
- middleware/static/config.go (1 hunks)
- middleware/static/static_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- middleware/static/config.go
- middleware/static/static_test.go
Additional Context Used
Markdownlint (8)
docs/middleware/static.md (8)
144: Column: 1
Hard tabs
145: Column: 1
Hard tabs
146: Column: 1
Hard tabs
147: Column: 1
Hard tabs
149: Column: 1
Hard tabs
150: Column: 1
Hard tabs
151: Column: 1
Hard tabs
153: Column: 1
Hard tabs
Additional comments not posted (4)
docs/middleware/static.md (4)
9-11
: Clarify the default behavior of servingindex.html
.
34-36
: Consider using relative paths or configuration settings instead of hard-coded paths in the examples to enhance portability and flexibility.
70-70
: Please change the headlines to meaningful ones so that everyone knows what kind of example to expect.
168-170
: Revise the caution note for clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- docs/middleware/static.md (1 hunks)
Additional Context Used
LanguageTool (1)
docs/middleware/static.md (1)
Near line 162: You might be missing the article “the” here.
Context: ... | :::info You can setCacheDuration
config property to-1
t...
Rule ID: AI_EN_LECTOR_MISSING_DETERMINER_THE
Markdownlint (1)
docs/middleware/static.md (1)
22: null
Fenced code blocks should be surrounded by blank lines
Additional comments not posted (2)
docs/middleware/static.md (2)
9-11
: Clarify the default behavior of servingindex.html
.
141-143
: Revise the caution note for clarity.
| NotFoundHandler | `fiber.Handler` | NotFoundHandler defines a function to handle when the path is not found. | `nil` | | ||
|
||
:::info | ||
You can set `CacheDuration` config property to `-1` to disable caching. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding the definite article "the" for grammatical correctness.
- You can set `CacheDuration` config property to `-1` to disable caching.
+ You can set the `CacheDuration` config property to `-1` to disable caching.
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
You can set `CacheDuration` config property to `-1` to disable caching. | |
You can set the `CacheDuration` config property to `-1` to disable caching. |
## Examples | ||
|
||
Import the middleware package that is part of the [Fiber](https://github.com/gofiber/fiber) web framework | ||
```go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure fenced code blocks are surrounded by blank lines for proper formatting.
+
import(
Committable suggestion was skipped due low confidence.
Description
This PR converts Static into the middleware and adds support for
io/fs
interface to support embed.FS and os.DirFS.Also filesystem middleware is no longer necessary since static can do everything and more of what filesystem middleware can do. So i've also removed it.
To-Do List:
io/fs
usage.(fs: fix openIndexFile when dirPath is empty string valyala/fasthttp#1779 fs: fix GenerateIndexPages when DirFS or embed.FS is used valyala/fasthttp#1778)
Fixes #2031
Changes introduced
List the new features or adjustments introduced in this pull request. Provide details on benchmarks, documentation updates, changelog entries, and if applicable, the migration guide.
Type of change