Skip to content
This repository has been archived by the owner on Sep 23, 2021. It is now read-only.

process POST request body and pass it to the action #179

Closed
rofe opened this issue Apr 4, 2019 · 8 comments
Closed

process POST request body and pass it to the action #179

rofe opened this issue Apr 4, 2019 · 8 comments
Assignees
Labels
enhancement New feature or request released

Comments

@rofe
Copy link
Contributor

rofe commented Apr 4, 2019

Like openwhisk, the helix-simulator should process the request body and provide it to the action.

@rofe rofe added the enhancement New feature or request label Apr 4, 2019
@rofe rofe self-assigned this Apr 4, 2019
@tripodsan
Copy link
Contributor

Can you elaborate an example of what is missing? Do you want to handle POST requests?

@rofe rofe changed the title process request body and add it to the payload process request body and pass it to the pipeline Apr 4, 2019
@tripodsan
Copy link
Contributor

Btw: do you mean context.request.body ?

@rofe
Copy link
Contributor Author

rofe commented Apr 4, 2019

Yes, I'd like to be able to POST data to a local dev server and make use of the fact that the pipeline only fetches markdown if there isn't already a content.body present in the payload, e.g. for live markdown preview. I can already do the same by posting {"content":"body":"foo"}} to a Helix html action in openwhisk, but when I do the same with a local server, payload.content is always empty. I would expect the simulator to behave the same as openwhisk.

@rofe rofe changed the title process request body and pass it to the pipeline process POST request body and pass it to the pipeline Apr 4, 2019
@tripodsan
Copy link
Contributor

I don't think we should mix things here. Everything coming from the request should be in context.request and not context.content

@rofe
Copy link
Contributor Author

rofe commented Apr 4, 2019

I can see your concerns. On the other hand, this is how skipping the fetch step in the pipeline was designed by @trieloff (and used in the authoring POC from the Berkeley hackathon), and this change here would allow developers/content authors to make use also in local development. It could come in handy for "as you type" markdown previewing at some point...

I'm open to refactoring all of it and propose to discuss the implementation details in #180 and adobe/helix-pipeline#236 respectively.

@tripodsan
Copy link
Contributor

ok, I was confused. yes, it should populate all action params, like openwhisk does:

The __ow_body property is present either when handling "raw" HTTP requests, or when the HTTP request entity is not a JSON object or form data. Web actions otherwise receive query and body parameters as first class properties in the action arguments with body parameters taking precedence over query parameters, which in turn take precedence over action and package parameters.

@tripodsan tripodsan changed the title process POST request body and pass it to the pipeline process POST request body and pass it to the action Apr 5, 2019
@rofe rofe closed this as completed in 4292fc7 Apr 11, 2019
tripodsan pushed a commit that referenced this issue Apr 11, 2019
# [2.12.0](v2.11.3...v2.12.0) (2019-04-11)

### Features

* **server:** process post request body ([#180](#180)), closes [#179](#179) ([4292fc7](4292fc7))
@tripodsan
Copy link
Contributor

🎉 This issue has been resolved in version 2.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@rofe
Copy link
Contributor Author

rofe commented Apr 11, 2019

Fixed in 4292fc7: top level properties in the request body will be passed as action params.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request released
Projects
None yet
Development

No branches or pull requests

2 participants