Skip to content

url.set() doesn't work as expected with property 'origin' #182

Open
@egold

Description

@egold

Very simple test:

const url = new Url("http://www.example.com/foo/bar");
url.set('origin', 'https://anotherorigin.com')
console.log('URL origin:', url.origin);
//Expected value: https://anotherorigin.com
//Actual value: http://www.example.com

Does not behave as described in documentation. Unless origin is an exception case for some reason, in which case it should be documented.

I get that it would be, since origin is a combination of other properties, but some warning/exception against using .set('origin') (OK) or support for being able to set it (better) would be great.

FWIW same thing happens using parse() code path:

var parsed = parse('http://www.example.com/foo/bar')
parsed.set('origin', 'https://anotherorigin.com')
console.log('Parsed:', parsed)
//Expected value: https://anotherorigin.com
//Actual value: http://www.example.com

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