13. Events & Response

Events & Response

Event-handling and creating a response are really important aspects of Functions as a Service. Take these quizzes to gauge how well you understand these aspects.

Assuming an event has a body, how do you retrieve and save that JSON body in code?

SOLUTION: `body = json.loads(event["body"])`

When formatting a JSON response you have to include several "string":value pairs. What strings are included in a simple JSON response? (Check ALL options that apply.)

SOLUTION:
  • statusCode
  • headers
  • body

To send a JSON payload as input or as a test, what kind of HTTP method should you use?

SOLUTION: POST