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

feat(protocol): Add custom request handling #32

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Commits on Jun 28, 2024

  1. feat(protocol): Add custom request handling

    This commit introduces the ability to handle custom requests in the
    protocol package. A new struct, CustomRequestHandler, has been added
    which contains a Method and a Func. The Func is a function that takes
    a context and params and returns an error.
    
    The Handler struct now includes a slice of CustomRequestHandlers, and
    the Handle method has been updated to handle custom requests by
    unmarshalling the params into the handler's params and then calling
    the handler's Func.
    
    A new method, FindCustomRequestHandler, has been added to the Handler
    struct. This method takes a method string and returns the corresponding
    CustomRequestHandler and a boolean indicating whether the handler was
    found.
    
    The server's handle method has also been updated to handle errors from
    the Handler's Handle method.
    tris203 committed Jun 28, 2024
    Configuration menu
    Copy the full SHA
    4fe57f1 View commit details
    Browse the repository at this point in the history
  2. feat(protocol): change CustomRequestFunc return type

    The return type of CustomRequestFunc in both protocol_3_16 and
    protocol_3_17 has been changed from error to (any, error). This
    allows the function to return a result alongside an error. The
    Handler's Handle method has been updated to accommodate this
    change.
    tris203 committed Jun 28, 2024
    Configuration menu
    Copy the full SHA
    f933cc6 View commit details
    Browse the repository at this point in the history

Commits on Jul 3, 2024

  1. Configuration menu
    Copy the full SHA
    e9c4816 View commit details
    Browse the repository at this point in the history
  2. refactor(protocol): Make 'Params' field public in CustomRequestHandler

    The 'params' field in the CustomRequestHandler struct has been renamed
    to 'Params' and made public. This change is reflected in the associated
    methods where 'params' was used. The 'protocol_3_17/custom.go' file has
    been deleted. The 'FindCustomRequestHandler' method
    now returns a 'protocol316.CustomRequestHandler' instead of a
    'CustomRequestHandler'.
    tris203 committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    f562f77 View commit details
    Browse the repository at this point in the history