Skip to content

Request - Header-Based Routing Options #985

@mark-ross

Description

@mark-ross

Hello!

This is an amazing package that solves a TON of boilerplate and offers a lot of great value. The more I use it, the more I'd love to adopt it on a more broad case; however, I'm finding there's one missing requirement.

The platform I'm building for has a requirement that routes can be defined by the URL as well as the Content-Type Header value. This is used when specifying breaking changes between model versions as opposed to in-line version attributes within the URL.

For example:

  • Content-Type: model.v1+json should be routed to some handleModelV1 function
  • Content-Type: model.v2+json should be routed to some handleModelV2 function
  • Content-Type: application/json should be ALSO routed to some handleModelV2 function

I think this part is where things get a bit tricky. I know the underlying tools are router agnostics, and some of the routers support this type of routing while others do not. Is there a way from within Huma to support this type of header-based routing?

Thanks for your time and consideration!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions