falconry / falconry/falcon

Do API versioning by 'Accept' field in request header

Open
#932 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation proposal
Dominant language
Python
Stars
9.8k
Forks
1k
Avg merge
5d 9h
Merged PRs (30d)
9

Description

I have a requirement that need to route request to different resource class by the 'Accept' fields in the request HTTP header.

What I think is to write a middleware with process_request that parse req.accept and change the uri of the request. Then use route to route the "real" uri to different handlers.
But it seems that the uri of the request cannot be set directly. I check the property, change the path instance variable maybe can change the uri.

Is there any elegant approach to fulfill requirement using falcon?

Thanks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing Falcon's middleware process_request hook, req.accept handling, and route matching behavior. Determine whether API versioning by the HTTP Accept header has a supported routing approach without directly changing the URI, and define the expected resource-selection behavior before considering an implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.