request-data
processor can be used to find the data from the HTTP request. Query string and named-path parameters or from request body.curl 'http://127.0.0.1:8000/test/?message=hello%20world'
message
, you can do it like this:-- import: fastn/processors as pr -- string message: $processor$: pr.request-data -- ds.markdown: $message
curl 'http://127.0.0.1:8000/test/'
message
, the earlier code will return HTTP 500 Error (this is a bug, should return 404), one way to avoid that is to specify a default value:-- import: fastn/processors as pr -- string message: hello $processor$: pr.request-data -- ds.markdown: $message
hello
, so if message
is not found the HTTP request, the variable message
be assiged the default value, hello
.curl 'http://127.0.0.1:8000/test/?message=hello%20world&flag=true'
message
with value hello world
and flag
with value true
. We can access them ftd
file by using request-data
processor.-- import: fastn/processors as pr -- record r-data: string message: default value of message boolean flag: -- r-data data: $processor$: pr.request-data -- ds.markdown: $data.message
-- fastn.dynamic-urls: # RD Test: url: /rd-test/<string:message>/ document: ftd-host/r.ftd flag: false
flag: false
in the dynamic URL configuration, and it will be picked up.application/json
, the body is parsed as JSON and the fields in your record are looked in the JSON as well.FASTN.ftd
is highest priorityHave a question or need help?
Visit our GitHub Q&A discussion to get answers and subscribe to it to stay tuned.
Join our Discord channel and share your thoughts, suggestion, question etc.
Connect with our community!We welcome you to join our Discord community today.
We are trying to create the language for human beings and we do not believe it would be possible without your support. We would love to hear from you.