-
Notifications
You must be signed in to change notification settings - Fork 22
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
Usage of ASGI client with CORS #47
Comments
@ahopkins |
It is a test client only. It reaches in and executes the Middleware, listeners, and handlers without having to startup a server. |
Ok, I might have to think about this some more. SPF does some initialization on the app's Executing a route (or middleware) on the Sanic app without first booting the app causes the request to be pass through SPF while it is still in its "setup" state, and results in unspecified operation, that is why there is an assertion inserted at that point. The message "App must be running before you can run middleware!" could definitely be tweaked to make it more clear why the error is emitted. Its not reasonable to expect the The |
Yeah, I'd say let's get test mode merged and released and the sanic test client broken out. They seem like that would help a lot. |
Yep, simplest way forward would be simply skip all SPF-derived routes and middleware when in test mode. That wouldn't matter for something like CORS, but for other plugins maybe thats not a good long-term solution. This PR sanic-org/sanic#1894 is still showing test errors. Is it ok to merge as-is? |
Yes, after I figure those tests out. |
@ahopkins I've pushed a new version of Sanic-Plugins-Framework v0.9.3, it has a simple mechanism to switch SPF into serverless "running" mode if a request is received before the app is started, and the app is in asgi mode. Can you please upgrade your SPF to 0.9.3 to see if it fixes this problem for you? |
I think this is a problem more with SPF than this project. However, there is an exception when trying to run the ASGI test client.
There is a PR on the Sanic repo that would help this by adding a
test_mode
flag to the app instance.The text was updated successfully, but these errors were encountered: