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

Expose base path to the action #311

Open
akrabat opened this issue Jun 10, 2018 · 2 comments
Open

Expose base path to the action #311

akrabat opened this issue Jun 10, 2018 · 2 comments

Comments

@akrabat
Copy link
Member

akrabat commented Jun 10, 2018

I'm trying to find a way to determine the fully qualified base URL that was used for my action so that I can create URLs in my payloads to other resources in my API.

e.g. if you set up as per https://github.com/apache/incubator-openwhisk/blob/master/docs/apigateway.md#exposing-multiple-web-actions then:

  • Given a POST /club/books, I need to generate a URL to /club/books/{new id}
  • Given a GET to /club/books/12, then I want to generate a URL to /club/books/34 which is by the same author.

As it stands, we have:

  • __ow_headers => x-forwarded-url which provides the fully qualified URL that was used to invoke this action
  • __ow_path which is some characters from the end of the x-forwarded-url URL.

My initial idea was to subtract __ow_path from __ow_headers, but it doesn't work as __ow_path is very different depending on if there's a placeholder in the path:

i.e. if you call the URL for /club/books/, then __ow_path is /, but if you call the URL for /club/books/12 the __ow_path is /club/books/12

Suggested solution:

Provide __ow_base_path which is equal to /club in this example.

@ddragosd
Copy link
Contributor

Provide __ow_base_path which is equal to /club in this example.

I think we can also assume that when developers use swagger spec, that basePath would be /club ?

@mhamann
Copy link
Member

mhamann commented Jun 16, 2018

I would agree that the basePath from the swagger is the right thing.

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

No branches or pull requests

3 participants