Skip to content

prefixUrl is unneededly applied to absolute urls #291

@ux-engineer

Description

@ux-engineer

I'm having a problem with prefixUrl option:

const ky = Ky.extend({
  prefixUrl: API_BASE_URL,
});

Our backend API is returning absolute download paths which already include the base url. In those cases we end up with request urls having prefixed twice with the base url.

Could we have prefixUrl option's behavior altered so that it checks if the url already starts with this value, and if so it would not prefix it there?

I tried to create a beforeRequest hook to modify request.url, but it seems the hook cannot modify that property. That approach would have averted having to check and modify urls in possibly multiple parts of the codebase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions