add middleware to convert all requests with yaml content type to json#29
add middleware to convert all requests with yaml content type to json#29Adamkadaban wants to merge 5 commits intomainfrom
Conversation
|
@alexchristy it seems that I can set up manual scoping bc So I can make a set of routes that are allowed here and put it in some config file somewhere. Where do you think that config should go? I also think we may want to put the middleware in a separate file than |
I was thinking in a folder |
|
looks like I don't even have to do anything weird with the url field. I can just make the middleware only for the templates router |
|
Closing this in favor of new branch to make PR easier |
Checklist
Description
This PR will allow users to supply yaml, which will be converted to JSON
This adds a FastAPI middleware to convert all requests with a content-type of yaml to one with a json body, content-type, etc.
Content type of
application/yamlis used as per RFC 9512.I ended up going for content-type instead of the get param
?yaml=true, as curl, fastapi test client, requests library, etc. all implicitly will set the content-type to json when a user provides json. I think this is better, since?yaml=falsewon't have to be provided to requests.Partially Fixes: #24
Note: There is currently no support for subnet-level tagging