Skip to content

Don't create a new resource with allow_head=True#2585

Merged
asvetlov merged 2 commits intomasterfrom
add_get
Dec 4, 2017
Merged

Don't create a new resource with allow_head=True#2585
asvetlov merged 2 commits intomasterfrom
add_get

Conversation

@asvetlov
Copy link
Copy Markdown
Member

@asvetlov asvetlov commented Dec 3, 2017

Backward incompatible but I believe almost nobody is affected.

@@ -0,0 +1 @@
Do not create a new resource on `router.add_get(..., allow_head=True)`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's improvement, not removal.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's both optimization and breaking change: in aiohttp 2.x the call router.add_get('/', handler, name='name') adds two named resources: name for GET and name-head for HEAD.
But both resources are identical.

After PR merging I want add generic optimization for sequential add_route() calls if created resource is the same.

router.add_get('/', ...)
router.add_post('/', ...)

should create the single resource if path and name are the same.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Dec 3, 2017

Codecov Report

Merging #2585 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2585   +/-   ##
=======================================
  Coverage   97.71%   97.71%           
=======================================
  Files          36       36           
  Lines        7229     7229           
  Branches     1262     1262           
=======================================
  Hits         7064     7064           
  Misses         58       58           
  Partials      107      107
Impacted Files Coverage Δ
aiohttp/web_urldispatcher.py 99.49% <100%> (ø) ⬆️

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 3ed3c9c...8cdcf7e. Read the comment docs.

@asvetlov asvetlov merged commit e0bb501 into master Dec 4, 2017
@asvetlov asvetlov deleted the add_get branch December 4, 2017 09:50
@lock
Copy link
Copy Markdown

lock bot commented Oct 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs.
If you feel like there's important points made in this discussion, please include those exceprts into that [new issue].
[new issue]: https://github.com/aio-libs/aiohttp/issues/new

@lock lock bot added the outdated label Oct 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 28, 2019
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bot:chronographer:provided There is a change note present in this PR outdated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants