Closed
Description
Update the http-filters.md
with an example of modifying incoming request data.
schema {
query: Query
mutation: Mutation
}
type Mutation {
createUser(input: InputUser): UserCreated @http(
method: POST,
path: "/users",
query: [{key: "user", value: "{{args.input}}"}] # pass input as an argument
}
input InputUser {
name: String
age: Int
}
function onRequest({request}) {
const user = JSON.parse(decodeURIComponent(request.uri.query.user))
request.uri.query = {}
request.body = {
userName: user.name,
userAge: user.age
}
return {request}
}
Something on the above lines.
IMPORTANT: Make sure you try the final configuration and that it works.