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

Implement the webactions at the proxy runtime level #71

Open
sciabarracom opened this issue Oct 30, 2024 · 0 comments
Open

Implement the webactions at the proxy runtime level #71

sciabarracom opened this issue Oct 30, 2024 · 0 comments
Assignees

Comments

@sciabarracom
Copy link
Contributor

sciabarracom commented Oct 30, 2024

Currently the go proxy for runtimes does not answer in port 8080 at the root level (the answer is empty). It answer to /run and returns a json.

The output for webactions is defined by this spec

In order to improve testability and also support knative using our runtimes, we should implement input and interpret the output of a web action directly in the proxy.

So if we invoke the proxy at the root: (http://localhost:8080/) it should work like /run but we should pass the parameters __ow_* as defined in the spec and then interpret the output according the webactions spec. For example if an action returns:

{ 
  "body": "<h1>hello</h1>"
}

it should NOT return the json but actually <h1>hello</h1>, with an appropriate content type (default text/html).

We should also implement the other fields. For example invoking http://localhost:8080/ for this aswer

{ 
  "statusCode": 307,
  "headers": { "Location": "https://www.google.com" } 
} 

will return an empty body with status coden 307 and the header Location to implement a redirect.

Finally we should support images:

the answer:

 { 'Content-Type': 'image/png' },
    statusCode: 200,
    body: "xxxxx" 
}

when the content type starts with image/ should decode the body as base64 encoded.

OpenWhisk also allow for setting the content tye extensions, so we should add the ability to use /index.html to returnthe body with default content-type text/html, while index.json will use content-type: application/json, index.txt returns text/plain, index.png and index.jpg returns image/png and image/jpeg.

@francescotimperi francescotimperi changed the title Impleement the webactions at the proxy runtime level Implement the webactions at the proxy runtime level Oct 30, 2024
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

3 participants