Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. 'use strict';
  2.  
  3. exports.handler = (event, context, callback) => {
  4. const response = event.Records[0].cf.response;
  5.  
  6. /**
  7. * This function updates the response status to 200 and generates static
  8. * body content to return to the viewer in the following scenario:
  9. * 1. The function is triggered in an origin response
  10. * 2. The response status from the origin server is an error status code (4xx or 5xx)
  11. */
  12.  
  13. if (response.status >= 400 && response.status <= 599) {
  14. response.status = 200;
  15. response.statusDescription = 'OK';
  16. response.body = 'Body generation example';
  17. }
  18.  
  19. callback(null, response);
  20. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement