Skip to content

Support using async views for Flask 2.0#41

Merged
greyli merged 2 commits intomasterfrom
async-support
May 11, 2021
Merged

Support using async views for Flask 2.0#41
greyli merged 2 commits intomasterfrom
async-support

Conversation

@greyli
Copy link
Copy Markdown
Member

@greyli greyli commented May 8, 2021

A fix for Flask 2.0's async support.

@app.get('/')
async def say_hello():
    await asyncio.sleep(1)
    return {'message': 'Hello!'}


@app.get('/pets/<int:pet_id>')
@output(PetOutSchema)
async def get_pet(pet_id):
    if pet_id > len(pets) - 1:
        abort(404)
    return pets[pet_id]

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add or update relevant docs, in the docs folder and in code docstring.
  • Add an entry in CHANGES.md summarizing the change and linking to the issue and your username.
  • Add *Version Changed* or *Version Added* note in any relevant docs and docstring.
  • Run pytest and tox, no tests failed.

@netlify
Copy link
Copy Markdown

netlify bot commented May 8, 2021

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 8, 2021

Codecov Report

Merging #41 (4c8a012) into master (357b805) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #41   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           14        14           
  Lines          836       836           
  Branches       147       147           
=========================================
  Hits           836       836           
Impacted Files Coverage Δ
apiflask/decorators.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 357b805...4c8a012. Read the comment docs.

@greyli greyli changed the title Support using async views Support using async views for Flask 2.0 May 8, 2021
@greyli greyli merged commit eb48d9a into master May 11, 2021
@greyli greyli deleted the async-support branch May 11, 2021 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants