From 1805b8bd660ab8d41c1807b972f0559da4b16792 Mon Sep 17 00:00:00 2001 From: ruslandoga <67764432+ruslandoga@users.noreply.github.com> Date: Tue, 4 Jun 2024 15:33:30 +0700 Subject: [PATCH] move json encoding to json operation --- lib/ex_aws/operation/json.ex | 2 +- lib/ex_aws/request.ex | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/ex_aws/operation/json.ex b/lib/ex_aws/operation/json.ex index e3d07c82..036b3f2f 100644 --- a/lib/ex_aws/operation/json.ex +++ b/lib/ex_aws/operation/json.ex @@ -50,7 +50,7 @@ defimpl ExAws.Operation, for: ExAws.Operation.JSON do ExAws.Request.request( operation.http_method, url, - operation.data, + config[:json_codec].encode!(operation.data), headers, config, operation.service diff --git a/lib/ex_aws/request.ex b/lib/ex_aws/request.ex index b72f7064..5d0f3419 100644 --- a/lib/ex_aws/request.ex +++ b/lib/ex_aws/request.ex @@ -9,14 +9,7 @@ defmodule ExAws.Request do @type error_t :: {:error, {:http_error, http_status, binary}} @type response_t :: success_t | error_t - def request(http_method, url, data, headers, config, service) do - body = - case data do - [] -> "{}" - d when is_binary(d) -> d - _ -> config[:json_codec].encode!(data) - end - + def request(http_method, url, body, headers, config, service) do request_and_retry(http_method, url, service, config, headers, body, {:attempt, 1}) end