You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some cors tests did not opt out for non-cors endpoints.
deftest_cors_allow_all_request_origins():
# GIVEN a function with cors=True# AND http method set to GETapp=ApiGatewayResolver(
cors=CORSConfig(
allow_origin="*",
allow_credentials=True,
),
)
@app.get("/my/path", cors=True)defwith_cors() ->Response:
returnResponse(200, content_types.TEXT_HTML, "test")
@app.get("/without-cors")defwithout_cors() ->Response:
returnResponse(200, content_types.TEXT_HTML, "test")
Which area does this relate to?
Tests
Solution
opt out cors instead of opt-in.
deftest_cors_allow_all_request_origins():
# GIVEN a function# AND http method set to GETapp=ApiGatewayResolver(
cors=CORSConfig(
allow_origin="*",
allow_credentials=True,
),
)
@app.get("/my/path")defwith_cors() ->Response:
returnResponse(200, content_types.TEXT_HTML, "test")
@app.get("/without-cors", cors=False)defwithout_cors() ->Response:
returnResponse(200, content_types.TEXT_HTML, "test")
Why is this needed?
Some cors tests did not opt out for non-cors endpoints.
Which area does this relate to?
Tests
Solution
opt out cors instead of opt-in.
Acknowledgment
The text was updated successfully, but these errors were encountered: