Comments (10)
Happenning the same here but using Swagger UI, so the problem may not be specific to test_client
but to general API routing.
What's more, maybe issue #1823 may help by fixing starlette
version
from connexion.
This is because Connexion lazily initializes the routing when the first ASGI call is received.
Workaround:
# Workaround for race condition in connexion initialization
# pylint: disable=protected-access
connexion_app.middleware.app, connexion_app.middleware.middleware_stack = \
connexion_app.middleware._build_middleware_stack()
Excuse the comment, (it also causes a race condition in startup if you're using werkzeug with threads, and a wsgi-asgi converter).
Correct solution is probably to convert your unit tests to use the provided startlette TestClient, but that involves some work as the API is significantly different. connexion_app.test_client()
from connexion.
The issue is being discussed on the starlette repo here.
from connexion.
3.0.4 has been released containing this fix.
from connexion.
Are you still using the Flask test client? Because that is not expected to work anymore. You should use the Connexion test client.
from connexion.
Happenning the same here but using Swagger UI, so the problem may not be specific to
test_client
but to general API routing.What's more, maybe issue #1823 may help by fixing
starlette
version
Thanks for your reply!
I tried multiple versions of starlette 0.27, 0.32.0.post1 and 0.33 but it did not help.
from connexion.
Thanks for the reports everyone. I just submitted #1828 to set an upperbound to our Starlette dependency. We'll release it as soon as possible and will investigate the underlying issue afterwards.
from connexion.
Closing in favor of #1824
from connexion.
@RobbeSneyders Thanks for the quick update!
Unfortunately it also does not work with connexion 3.0.4 and starlette < 0.33.
In #1824 there is a different error which seems to be fixed with the pinned starlette version.
Same error as in the first post:
werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
from connexion.
Are you still using the Flask test client? Because that is not expected to work anymore. You should use the Connexion test client.
Yes I tried the Flask test client. Alright thanks, I just switched to the connexion test client and got it working with POST/PUT request. For anyone interested:
Before (Flask test client):
response = app.put(
"/myroute",
content_type="application/json",
data=json.dumps(body),
query_string={"param": param},
)
After (Connexion test client):
response = app.put(
"/myroute",
headers={"Content-Type": "application/json"},
data=json.dumps(body),
params={"param": param},
)
There are also some changes needed with checking the response, but I will figure it out :)
from connexion.
Related Issues (20)
- Frozen application can't run
- Maintenance release with less restrictive dependencies HOT 1
- How to add Prometheus client /metrics endpoint to Connexion 3.x AsyncApp? HOT 3
- Validation error with multipart/form-data and object type property HOT 1
- allOf doesn't work with multipart/form-data
- Arrays are parsed incorrectly with multipart/form-data HOT 1
- Release 3.0.6? HOT 4
- Add request as an optional kwarg to auth flow HOT 2
- Stream large file to AsyncApp (application/octet-stream) HOT 7
- Execution Order Issue: before_request Executing After x-apikeyInfoFunc Authentication Method HOT 1
- RoutingMiddleware should sort paths HOT 1
- Migrating to Connexion 3: Issues with current_app and g for Authentication and Request Lifecycle HOT 4
- g object is not accessible in x-bearerInfoFunc HOT 1
- Import issues when using editable install HOT 1
- Treats trailing slashes differently for swagger and normal endpoints HOT 2
- Missing API documentation HOT 2
- Document that ConnexionMiddleware might require to specifiy routes explicitly HOT 2
- Question: Using `validate_responses=True` in connexion 3.* HOT 1
- All defaults from all OneOf schema options get propagated using the DefaultJSONValidator
- swagger-ui not resolving external references
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from connexion.