Skip to content

Make "/yambas/rest" optional in the base URL #1

@philippgille

Description

@philippgille

Always having to include "/yambas/rest" in base URLs is annoying and should be handled automatically.

Implementation proposal:

When the aoms.DefaultClient is instantiated or sends its first request, it should do the following:

  1. Check if the baseUrl parameter/field (depending on if this gets implemented for instantiation or first request) contains "/yambas/rest".
    • If it does: Keep it that way.
    • If it doesn't: Add it, because in most cases it's necessary (or maybe currently even mandatory, depending on URL rewrites in ApiOmat and SDK implementations).
  2. Probe if the (possibly changed) baseUrl is correct by calling GetVersion() and expecting a version string in the response body. A short timeout should be used and errors should be ignored.
    • If it didn't work, and "/yambas/rest" was previously added manually: Probe again with the original passed baseUrl.
      • If this worked: Use the original baseUrl as base URL.
      • If this didn't work: Ignore, because the probe requests were unsolicited and the caller needs to find out about the error on his own when making the first request.
    • If it worked: Use the (possibly changed) baseUrl as base URL.

Also necessary:

  • Add tests to aoms
  • Change doc comments and README accordingly

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions