Add URL with fragment to ClientResponse#2925
Add URL with fragment to ClientResponse#2925asvetlov merged 5 commits intoaio-libs:masterfrom hdk5:fix_response_url_fragment
Conversation
|
I had a trouble retrieving URL fragment from response URL. I am aware that request should be sent without URL fragment, but I don't think that URL from response should be modified. |
Codecov Report
@@ Coverage Diff @@
## master #2925 +/- ##
==========================================
+ Coverage 97.99% 97.99% +<.01%
==========================================
Files 40 40
Lines 7514 7520 +6
Branches 1318 1318
==========================================
+ Hits 7363 7369 +6
Misses 48 48
Partials 103 103
Continue to review full report at Codecov.
|
|
HTTP response has no URL (unless it is not 3xx redirection).
|
This is what i meant. I need to know full URL I am getting redirected to because this is how I get application token. Here is a little example: https://dry-meadow-80563.herokuapp.com/tokenask It redirects to |
| q.extend(url2.query) | ||
| url = url.with_query(q) | ||
| self.url = url.with_fragment(None) | ||
| self.original_url = url |
There was a problem hiding this comment.
Also, this code before my commit looks strange to me:
self.url = url.with_fragment(None)
self.original_url = urlBoth url and original_url are not modified after (at least by the object itself), so they are always the same.
And then original_url is passed as url for ClientResponse.
So, wasn't it actually intended to keep URL fragment in response object?
|
Let's consider The public API is By this, we will keep the behavior of existing code and provide a way for getting original unmodified URLs. Opinions? |
This might be a solution. But can you please explain my previous comment on code and this commit? |
|
Looks like @fafhrd91 wanted to implement exactly your initial intention, later we broke the behavior again.
|
|
Should I just put real url in |
|
I think we need both Documentation and tests are mandatory. |
| .. attribute:: real_url | ||
|
|
||
| Unmodified URL of request (:class:`~yarl.URL`). | ||
|
|
There was a problem hiding this comment.
Please add .. versionadded:: 3.2 tag
| .. attribute:: real_url | ||
|
|
||
| Requested *url* with URL fragment unstripped, :class:`yarl.URL` instance. | ||
|
|
|
Thanks! |
* Fixed ClientResponse URL fragment * Added news entry * ClientResponse real_url property + doc + test * Fixed flake8 and doc-spelling errors * Updated docs
|
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. |
What do these changes do?
ClientResponse and RequestInfo now have real_url property, which is request url without fragment part being stripped
Checklist
CONTRIBUTORS.txtCHANGESfolder