From 03ce011edf0fea08a1e2b52c51f12c5df3652dcd Mon Sep 17 00:00:00 2001 From: eloisa-castro Date: Sun, 5 Apr 2020 16:47:21 -0300 Subject: [PATCH] =?UTF-8?q?Resolu=C3=A7=C3=A3o=20das=20tarefas=201,=202,?= =?UTF-8?q?=204=20e=205?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- semana20/aula3/exercicio1.txt | 31 +++++++++++++++++++++++++++++++ semana20/aula3/exercicio2.txt | 6 ++++++ semana20/aula3/tarefa5 | 1 + 3 files changed, 38 insertions(+) create mode 100644 semana20/aula3/exercicio1.txt create mode 100644 semana20/aula3/exercicio2.txt create mode 160000 semana20/aula3/tarefa5 diff --git a/semana20/aula3/exercicio1.txt b/semana20/aula3/exercicio1.txt new file mode 100644 index 0000000..94f810f --- /dev/null +++ b/semana20/aula3/exercicio1.txt @@ -0,0 +1,31 @@ +/** Tarefa 1 */ +exports.handler = async (event) => { + const reqBody = JSON.parse(event.body) + const response = { + statusCode: 200, + body: JSON.stringify(`Hello ${reqBody.name}`), + }; + return response; +}; + +/** Tarefa 2 */ +// 1 +verifyExistence(undefined) --> retorna false +verifyExistence(null) --> retorna false +verifyExistence("Teste") --> retorna true + +// 2 +Porque o retorno de event.body é uma string. + +// 3 +Essa lambda retorna o código 200 quando for passado um body ou um query parameter. + +// 4 +Essa lambda retorna o código 400 quando não é enviado um body (ou quando este é vazio) e não é enviado um query parameter. + +// 5 +Testes realizados: +- com body vazio e sem query parameters --> retorno código 400 +- com informações no bodye e sem query parameters --> retorno código 200 +- sem informações no bodye e com query parameters --> retorno código 200 +- com informações no bodye e query parameters --> retorno código 200 \ No newline at end of file diff --git a/semana20/aula3/exercicio2.txt b/semana20/aula3/exercicio2.txt new file mode 100644 index 0000000..70a8c55 --- /dev/null +++ b/semana20/aula3/exercicio2.txt @@ -0,0 +1,6 @@ +/** Tarefa 4 */ +Configuração realizada. + + +/** Tarefa 2 */ +Resolução na pasta "tarefa5". \ No newline at end of file diff --git a/semana20/aula3/tarefa5 b/semana20/aula3/tarefa5 new file mode 160000 index 0000000..1954342 --- /dev/null +++ b/semana20/aula3/tarefa5 @@ -0,0 +1 @@ +Subproject commit 19543424089708b9fe6859fa60ba09944b8b20de