Skip to content

Commit

Permalink
feat: ensure AxiosHttpClient returns correct values
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorverasm committed Jan 17, 2021
1 parent c6bd687 commit 71903f4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/infra/http/axios-http-client/axios-http-client.ts
Original file line number Diff line number Diff line change
@@ -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<any>): Promise<void> {
await axios.post(params.url, params.body);
export class AxiosHttpClient implements HttpPostClient<any, any> {
async post(params: HttpPostParams<any>): Promise<HttpResponse<any>> {
const httpResponse = await axios.post(params.url, params.body);
return {statusCode: httpResponse.status, data: httpResponse.data};
}
}

0 comments on commit 71903f4

Please sign in to comment.