Skip to content

Use urlparse to generate websocket url#247

Merged
mbohlool merged 1 commit intokubernetes-client:masterfrom
pokoli:websocket_url
Jun 15, 2017
Merged

Use urlparse to generate websocket url#247
mbohlool merged 1 commit intokubernetes-client:masterfrom
pokoli:websocket_url

Conversation

@pokoli
Copy link

@pokoli pokoli commented Jun 7, 2017

Fixes #246

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 7, 2017
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add empty line above.

@@ -0,0 +1,36 @@
# Copyright 2016 The Kubernetes Authors.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: 2017.

@mbohlool
Copy link
Contributor

mbohlool commented Jun 8, 2017

I will wait for @foklepoint to test this before merging. If you didn't change anything else in this PR, ignore "nit" comments. Thanks.

url = url.replace('https://', 'wss://')

# patch extra /
url = url.replace('//api', '/api')

Choose a reason for hiding this comment

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

Is this logic present in the new code? I can't find the context in the history as to why we need it

Copy link
Author

Choose a reason for hiding this comment

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

No, it's not present on the new code, but I don't see why it should be required.

Do you have some sample url that uses this replace?

Choose a reason for hiding this comment

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

Sorry, nope. But I would be in favor of removing it if we can't track down why it was added

@mbohlool
Copy link
Contributor

@dims I think you added the original code. Can you answer the question?

@mbohlool
Copy link
Contributor

I am fine with the new code doesn't have the logic to replacing "//api" with "/api". I would say we can merge this (after rebase) and if @dims has objection we can always patch it.

@mbohlool mbohlool added lgtm "Looks good to me", indicates that a PR is ready to be merged. need-rebase labels Jun 14, 2017
if parsed_url.scheme == 'http':
parts[0] = 'ws'
else:
parts[0] = 'wss'
Copy link
Contributor

@mbohlool mbohlool Jun 9, 2017

Choose a reason for hiding this comment

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

nit: should we also check if it is https, just to cover all cases.

@pokoli
Copy link
Author

pokoli commented Jun 15, 2017

I've fixed the comment and rebased it.

Thank you all for your time.

@mbohlool mbohlool merged commit 5521d84 into kubernetes-client:master Jun 15, 2017
yliaog pushed a commit to yliaog/client-python that referenced this pull request Jan 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. need-rebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants