Skip to content

Conversation

dolfinus
Copy link
Contributor

@dolfinus dolfinus commented Jan 10, 2022

Change Summary

Previously passing the port argument into HttpUrl.build() method has lead to including this port number to the output:

assert 'http://example.com:123' == HttpUrl.build(schema='http', host='example.com', port='123')

But a regression was introduced in #2447.

It looks like the desired behavior was to hide default port number for the protocol, but instead any port number was just being ignored.

So I've fixed a check, that only default port numbers become hidden, like 80 for http or 443 to https. Non-default port numbers are left unchanged.
Also I've added a test to cover this case.

Related issue number

No

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes where applicable
  • changes/<pull request or issue id>-<github username>.md file added describing change
    (see changes/README.md for details)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

@dolfinus dolfinus marked this pull request as ready for review January 10, 2022 19:31
@dolfinus
Copy link
Contributor Author

please review

Copy link
Member

@samuelcolvin samuelcolvin left a comment

Choose a reason for hiding this comment

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

otherwise I think makes sense.

@samuelcolvin
Copy link
Member

please update.

@github-actions github-actions bot added awaiting author revision awaiting changes from the PR author and removed ready for review labels Apr 2, 2022
@github-actions github-actions bot assigned dolfinus and unassigned samuelcolvin and PrettyWood Apr 2, 2022
@samuelcolvin samuelcolvin added this to the v1.9.1 milestone Apr 2, 2022
dolfinus and others added 5 commits April 2, 2022 17:16
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
@dolfinus dolfinus requested a review from samuelcolvin April 2, 2022 14:44
@dolfinus
Copy link
Contributor Author

dolfinus commented Apr 2, 2022

Fixed, please check

@samuelcolvin samuelcolvin mentioned this pull request May 14, 2022
11 tasks
@samuelcolvin samuelcolvin merged commit cc54acb into pydantic:master May 14, 2022
@samuelcolvin
Copy link
Member

thanks so much.

squarebridges pushed a commit to nicejobinc/pydantic that referenced this pull request Jun 24, 2022
* Port number is no longer being ignored by HttpUrl.build()

* Update tests/test_networks.py

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>

* Update networks.py

* Update tests/test_networks.py

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>

* Update test_networks.py

* Update test_networks.py

* update change description

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting author revision awaiting changes from the PR author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants