Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrectly overrides the template route #54

Open
agzam opened this issue Feb 9, 2023 · 2 comments
Open

Incorrectly overrides the template route #54

agzam opened this issue Feb 9, 2023 · 2 comments

Comments

@agzam
Copy link
Contributor

agzam commented Feb 9, 2023

If there are multiple templates within the same hierarchy of headings, i.e.,

* Requests                               :verb:
  template https://domain1:8080/rest/

** Cats
    template https://api.thecatapi.com/v1

*** breeds
    GET /breeds

Attempting to send a request for /breeds, tries to use the route: https://api.thecatapi.com/v1/rest//breeds, whereas it should be https://api.thecatapi.com/v1/breeds.

@agzam agzam changed the title Incorrectly override the template route Incorrectly overrides the template route Feb 9, 2023
@federicotdn
Copy link
Owner

This behaviour is currently by-design - the docs desrcribe this to some extent:

Host: The last defined heading's URL host will be used.
Path: All paths will be concatenated, starting with the first heading (i.e. the topmost parent).

I have run into cases however where I re-defined the host part of the URL at some middle point of the Org heading hierarchy, and it is true that the result is a bit unexpected (i.e. the last host, but all the paths appended). Maybe if the host is re-defined at any level, this should effectively reset all other components of the URL as well. This would be a relatively large change in terms of user experience.

@agzam
Copy link
Contributor Author

agzam commented Mar 2, 2023

But why not fix it? The template always starts with "http|https", right? Can it somehow reset the "topmost parent" if it gets redefined down the route while traversing the headings?

Hmm, wait. I might be missing something else there. Need to consult the code and think of some other use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants