Replies: 1 comment
-
+1 for this approach. GET handlers might also be possible computationally expensive, which would be wasted if the body is generated and then thrown away |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Currently Starlite does not support
OPTIONSandHEADmethods because we do not use the Starlette routing system. In Starlette, these two methods are automatically set ofGETroutes. This though does not seem to be the correct way to handle this.For
OPTIONSspecifically we need to factor in the behaviour of the CORS middleware, which can in priniciple acceptOPTIONSpreflight requests. The Starlette CORSMiddleware implements this in such a way that preflight responses are returned forOPTIONSonly when the headerAccess-Control-Request-Methodis set. I am not certain this is the correct behaviour and we need to clarify this, we might need to either subclass the Starlette middleware or create our own version if it isn't the desired behaviour.Otherwise for
OPTIONSI think we should probably resolve this with a special method that populates theAllowheader. The question really is what values need to be returned from this method, which will determine where and how implementation should look.HEADis a different creature. In principle we can useGETrequest handlers for this, but switch the status code to 204 and strip the body. The problem is that users might createGEThandlers that perform side effects etc. and this is going to be an issue. We might therefore consider adding an explicit@headroute handler, but I am not certain.Please add you thoughts.
Beta Was this translation helpful? Give feedback.
All reactions