Why am I getting gibberish for http request body? - python-3.x

I'm trying to create a Slack bot that uses AWS lambda api gateway as the backend. However, the event payload I'm getting has an incomprehensible payload body.
In the example im following the body should be like
Am I supposed to decode the body somehow?
I'm following this guide exactly but I'm implementing the lambda function in python. I just don't know why my event isn't even getting the proper body.
https://youtu.be/XgFVzBNgidQ

The payload isn't gibberish it's just base64-encoded and can be decoded using a library or method that supports base64-decoding. Here's the decoded value:
token=xxxxxxxxxxxxxxxxx&team_id=TSQ1S1YKB&team_domain=dankscape&channel_id=CSQ1S2D2M&channel_name=bot&user_id=UT078Q6BA&user_name=the.dankscape&command=%2Fecho2&text=hi+spec&response_url=https%3A%2F%2Fhooks.slack.com%2Fcommands%2FTSQ1S1YKB%2F921356743414%2Fv3ltAkqOhjOU8HyLiOiMmJkG&trigger_id=908962933297.908060066657.da505f8459f1102a090444d8934e188b

Related

POST Multipart NodeJS with file JSON

I need to make a post using nodejs. I will send a text and a json file content to a url. Using insomia I can send normally (print below), but not in the code integration. Does anyone have an example?
SEND OK
ERROR

node multer posting form data with postman - no body received

I am using the example given here: https://github.com/expressjs/multer. However instead of using the form in the example, I am using Postman to POST some data, however I am getting an empty body. I have set Postman to use form-data. Any ideas what the problem could be?
Thanks

Invalid and trucated data receiving while calling node API get route

While calling Node API get HTTP method data comes in truncated format, incomplete JSON.
But when calling the same api using POSTMAN getting proper response.
If is there any issue regarding NodeAPI please guide how can I solve it?

How to send a url-encoded form data using post request in bot-framework composer

I have an API end-point which takes a query string as url-encoded form data and returns a json.
I have used "Content-Type":"application/x-www-form-urlencoded" as headers.
When I try sending "query=xxx" as body of http post call using composer I get an error in emulator saying "The parent is missing.".
When I try sending {"query":"xxx"} as body, I get an error in emulator saying :
Misused header name. Make sure request headers are used with HttpRequestMessage, response headers with HttpResponseMessage, and content headers with HttpContent objects.
In which format should I send the data?
You should send it like this:
URL:http://localhost:7071/api/GetStudentGrade
Body(string):studentID=${user.studentID}&coursecode=${user.coursecode}
Content type:application/x-www-form-urlencoded
Detailed image:
I think you have to change the body to an object, Also content type to application/json. Let me know if this resolves your issue.

encode request.query in express

I wrote a simple API to return requset.query in response.
Sample Url:
http://localhost:8082/redirect?requesttype=click&id=79992&redirectto=http://localhost:8081/redirect?name=john&id=123
This returns following response,
but on passing encoded Url things are working as expected(screenshot attached),
http://localhost:8082/redirect?requesttype=click&id=79992&redirectto=http%3A%2F%2Flocalhost%3A8081%2Fredirect%3Fname%3Djohn%26id%3D123
But our API is getting utilized by various customers, is there any method in express.js where I can automatically encode the Url and serve the request as expected.

Resources