Skip to content

Conversation

@hydrz
Copy link
Contributor

@hydrz hydrz commented May 7, 2025

This pull request introduces several changes, including improvements to error handling, updates to dependencies, the addition of a global request handler, and the removal of unused code. Below is a summary of the most important changes grouped by theme.

Error Handling Improvements:

  • Updated the Compress method in compress/compression.go to add error handling when retrieving a compressor from the pool. If the object is not of the expected type, an error is returned.

Dependency Updates:

  • Updated several dependencies in go.mod, including golang.org/x/net and google.golang.org/genproto, and removed unused indirect dependencies such as go.opentelemetry.io/otel.
  • Added new entries for updated dependencies in go.work.sum, including golang.org/x/crypto, golang.org/x/net, and golang.org/x/tools.

Global Request Handler Addition:

  • Introduced a globalHandler field in the serverOptions struct in server_option.go, allowing the server to define a global handler for all requests.
  • Added a GlobalHandler function in server_option.go to configure the globalHandler option. This handler wraps all requests that do not match registered services or methods.
  • Updated the NewServer function in server.go to apply the globalHandler to the HTTP handler chain if it is configured.

Code Cleanup:

  • Removed unused contextWithResponseWriter and ResponseWriterFromContext functions from srpc.go, simplifying the codebase.
  • Removed the unused contextWithResponseWriter call in the ServeHTTP method of srpc.go.…

@hydrz hydrz merged commit b8e89b6 into main May 7, 2025
@hydrz hydrz deleted the dev branch May 7, 2025 15:35
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.

2 participants