Skip to content

Expose header parsing error variables#2096

Merged
erikdubbelboer merged 2 commits intovalyala:masterfrom
ReneWerner87:master
Nov 12, 2025
Merged

Expose header parsing error variables#2096
erikdubbelboer merged 2 commits intovalyala:masterfrom
ReneWerner87:master

Conversation

@ReneWerner87
Copy link
Contributor

Summary

  • expose exported error variables for header parsing to replace inline error constructions
  • update header parsing logic and related utilities to rely on the exported errors
  • adjust server tests to reference the new exported error values

Copy link

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 refactors internal error variables to exported error variables, making them part of the public API. This allows API consumers to perform error checking and matching against specific error conditions.

  • All internal error variables (errNeedMore, errSmallBuffer, errNonNumericChars) are converted to exported versions with PascalCase naming
  • Multiple new exported error variables are introduced for various parsing and validation scenarios
  • All references throughout the codebase are updated to use the new exported error names

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
header.go Consolidates all error variable declarations into a single exported var block; updates all internal references to use new exported error names
headerscanner.go Updates error assignment to use exported ErrNeedMore
server.go Updates error comparison to use exported ErrNeedMore
server_test.go Updates test to use exported ErrSmallReadBuffer

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gaby
Copy link
Contributor

gaby commented Nov 11, 2025

👍 for this

@erikdubbelboer erikdubbelboer merged commit 2a82a57 into valyala:master Nov 12, 2025
13 checks passed
@erikdubbelboer
Copy link
Collaborator

Thanks!

@ReneWerner87
Copy link
Contributor Author

Just wanted to prevent such situations, not that you change the error messages and we are then outdated.

https://github.com/gofiber/fiber/blob/19cc3f56f09fa758fc6863c67c3747d6639029c2/app.go#L1327

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants