From 71903f4abd7f543361f4700fe9d8d9c899fb2cc3 Mon Sep 17 00:00:00 2001 From: Vitor Veras Date: Sun, 17 Jan 2021 03:46:37 -0300 Subject: [PATCH] feat: ensure AxiosHttpClient returns correct values --- .../http/axios-http-client/axios-http-client.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/infra/http/axios-http-client/axios-http-client.ts b/src/infra/http/axios-http-client/axios-http-client.ts index d397cee..8d1d344 100644 --- a/src/infra/http/axios-http-client/axios-http-client.ts +++ b/src/infra/http/axios-http-client/axios-http-client.ts @@ -1,8 +1,13 @@ -import {HttpPostParams} from '@/data/protocols/http'; +import { + HttpPostClient, + HttpPostParams, + HttpResponse, +} from '@/data/protocols/http'; import axios from 'axios'; -export class AxiosHttpClient { - async post(params: HttpPostParams): Promise { - await axios.post(params.url, params.body); +export class AxiosHttpClient implements HttpPostClient { + async post(params: HttpPostParams): Promise> { + const httpResponse = await axios.post(params.url, params.body); + return {statusCode: httpResponse.status, data: httpResponse.data}; } }