Skip to content

URI with no host and no leading slash in path creates a host #387

Closed
@seshness

Description

@seshness

I have code that looks like

const uri = new URI('')
  .protocol('food')
  .path('test/file.csv')
  .toString()

I expected uri to be food:///test/file.csv, but it's food://test/file.csv.
When re-parsing uri the host is now test and path has changed from test/file.csv to /file.csv.

Is this expected, and if so, should I ensure my path has a leading slash? Or, is this unexpected behaviour in the library?

Thanks for this library, and for your time!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions