Skip to content

Commit d425d63

Browse files
authored
Merge pull request #1569 from appwrite/fix-1482-fix-python-functions-context-examples
Update function request context variables for python and ruby
2 parents b6f5922 + 0a21930 commit d425d63

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/routes/docs/products/functions/develop/+page.markdoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,8 @@ return function ($context) {
575575
import json
576576

577577
def main(context):
578-
context.log(context.req.bodyText) # Raw request body, contains request data
579-
context.log(json.dumps(context.req.bodyJson)) # Object from parsed JSON request body, otherwise string
578+
context.log(context.req.body_text) # Raw request body, contains request data
579+
context.log(json.dumps(context.req.body_json)) # Object from parsed JSON request body, otherwise string
580580
context.log(json.dumps(context.req.headers)) # String key-value pairs of all request headers, keys are lowercase
581581
context.log(context.req.scheme) # Value of the x-forwarded-proto header, usually http or https
582582
context.log(context.req.method) # Request method, such as GET, POST, PUT, DELETE, PATCH, etc.
@@ -593,16 +593,16 @@ def main(context):
593593
require 'json'
594594

595595
def main(context)
596-
context.log(context.req.bodyText) # Raw request body, contains request data
597-
context.log(JSON.generate(context.req.bodyJson)) # Object from parsed JSON request body, otherwise string
596+
context.log(context.req.body_text) # Raw request body, contains request data
597+
context.log(JSON.generate(context.req.body_json)) # Object from parsed JSON request body, otherwise string
598598
context.log(JSON.generate(context.req.headers)) # String key-value pairs of all request headers, keys are lowercase
599599
context.log(context.req.scheme) # Value of the x-forwarded-proto header, usually http or https
600600
context.log(context.req.method) # Request method, such as GET, POST, PUT, DELETE, PATCH, etc.
601601
context.log(context.req.url) # Full URL, for example: http://awesome.appwrite.io:8000/v1/hooks?limit=12&offset=50
602602
context.log(context.req.host) # Hostname from the host header, such as awesome.appwrite.io
603603
context.log(context.req.port) # Port from the host header, for example 8000
604604
context.log(context.req.path) # Path part of URL, for example /v1/hooks
605-
context.log(context.req.queryString) # Raw query params string. For example "limit=12&offset=50"
605+
context.log(context.req.query_string) # Raw query params string. For example "limit=12&offset=50"
606606
context.log(JSON.generate(context.req.query)) # Parsed query params. For example, req.query.limit
607607

608608
return context.res.text("All the request parameters are logged to the Appwrite Console.")

0 commit comments

Comments
 (0)