Skip to content

Behaviour of Url::join #333

Closed
Closed
@theduke

Description

@theduke

Url::join has a very confusing name.
I would expect it to append a path segment.
Instead, it replaces the whole base path, which is quite awkward.

If you want to actually join, you have to:

let segments = url.path_segments_mut().unwrap()pop_if_empty().push("new-segment");

Personally I think join should append a new segment, but changing this might be too late...
If so, the time is now, before a 1.0.

Otherwise, I would suggest adding a new method, something like add_segment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions