Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed behavior of Url with empty query #1016

Merged
merged 2 commits into from Dec 6, 2021

Conversation

kzrnm
Copy link
Contributor

@kzrnm kzrnm commented Dec 6, 2021

Types of Changes

Prerequisites

Please make sure you can check the following two boxes:

  • I have read the CONTRIBUTING document
  • My code follows the code style of this project

Contribution Type

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue, please reference the issue id)
  • New feature (non-breaking change which adds functionality, make sure to open an associated issue first)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Description

Fix #1015

Fixed behavior of Url.SearchParams with empty query

old behavior

var url = new AngleSharp.Dom.Url("http://example.com/foo/bar");
Console.WriteLine(url.SearchParams.ToString()); // "="

new behavior

var url = new AngleSharp.Dom.Url("http://example.com/foo/bar");
Console.WriteLine(url.SearchParams.ToString()); // ""

Assigning null to Url.Query

old behavior

var url = new AngleSharp.Dom.Url("http://example.com/foo/bar");
Console.WriteLine(url.ToString());      // "http://example.com/foo/bar"
Console.WriteLine(url.Query ?? "null"); // null
url.Query = null;
Console.WriteLine(url.ToString());      // "http://example.com/foo/bar?"
Console.WriteLine(url.Query ?? "null"); // ""

new behavior

var url = new AngleSharp.Dom.Url("http://example.com/foo/bar");
Console.WriteLine(url.ToString());      // "http://example.com/foo/bar"
Console.WriteLine(url.Query ?? "null"); // null
url.Query = null;
Console.WriteLine(url.ToString());      // "http://example.com/foo/bar"
Console.WriteLine(url.Query ?? "null"); // null

@CLAassistant
Copy link

CLAassistant commented Dec 6, 2021

CLA assistant check
All committers have signed the CLA.

@kzrnm kzrnm changed the title Feature/#1015 Fixed behavior of Url with empty query Dec 6, 2021
Copy link
Contributor

@FlorianRappl FlorianRappl left a comment

Choose a reason for hiding this comment

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

LGTM - thanks! 🍻

@FlorianRappl FlorianRappl added this to the 0.17.0 milestone Dec 6, 2021
@FlorianRappl FlorianRappl merged commit c6bc711 into AngleSharp:devel Dec 6, 2021
@kzrnm kzrnm deleted the feature/#1015 branch December 7, 2021 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assigning null to Url.Query is not as expected
3 participants