Skip to content
This repository was archived by the owner on Mar 18, 2023. It is now read-only.
This repository was archived by the owner on Mar 18, 2023. It is now read-only.

Config endpoint assumes path will not end with / #150

@msavy

Description

@msavy

A valid URL such as http://localhost:8080/apiman/ in config.json5 endpoint (and possibly others) causes 'double forward slash', as UI code adds a / to the end of endpoint.

For example: http://localhost:8080/apiman/ causes http://locahost:8080/apiman//<rest of path>

Acceptance criteria

  • URL should be normalised so that slashed and non-slashed URLs work.

Possible solutions

  • Normalise by always trimming the slash from endpoints in #get<whatever> URL endpoints, (consistently throughout codebase so all config properties do the same).
  • Use built-in URL class to join URLs instead of doing it by hand new URL('/whatever', 'http://localhost:8080/apiman/').href
new URL('/whatever', 'http://localhost:8080/apiman/').href 
'http://localhost:8080/whatever'
new URL('/whatever', 'http://localhost:8080/apiman').href 
'http://localhost:8080/whatever'

Might be good to hide some of this behind the scenes, with an extra service endpoint like

getEndpoint(path: string): string { 
   return new URL(path, getEndpoint());
}

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