diff --git a/nimutils/awsclient.nim b/nimutils/awsclient.nim index bae1676..4da88d0 100644 --- a/nimutils/awsclient.nim +++ b/nimutils/awsclient.nim @@ -159,4 +159,10 @@ proc request*(client: var AwsClient, params: Table, headers: HttpHeaders = newHt client.httpClient.headers.table, client.scope) client.httpClient.headers.add("Authorization", auth) - return client.httpClient.safeRequest(url, action, payload, headers=headers) + return client.httpClient.safeRequest( + url, + action, + payload, + headers=headers, + only2xx=true, + ) diff --git a/nimutils/sinks.nim b/nimutils/sinks.nim index 7e9f759..d5877b3 100644 --- a/nimutils/sinks.nim +++ b/nimutils/sinks.nim @@ -299,10 +299,7 @@ proc s3SinkOut(msg: string, cfg: SinkConfig, t: Topic, ignored: StringTable) = newPath = joinPath(state.objPath, newTail) response = client.put_object(state.bucket, newPath, msg) - if not response.code.is2xx(): - raise newException(ValueError, response.status & ": " & response.body()) - else: - cfg.iolog(t, "Post to: " & newPath & "; response = " & response.status) + cfg.iolog(t, "Post to: " & newPath & "; response = " & response.status) proc httpHeaders(cfg: SinkConfig): HttpHeaders = var diff --git a/nimutils/stsclient.nim b/nimutils/stsclient.nim index 2aa2ac8..c0cea35 100644 --- a/nimutils/stsclient.nim +++ b/nimutils/stsclient.nim @@ -45,8 +45,6 @@ proc getCallerIdentity*(self: var StsClient): StsCallerIdentity = ("Content-Type", "application/x-www-form-urlencoded"), ("Accept", "application/json"), ])) - if res.code != Http200: - raise newException(ValueError, res.status) let jsonResponse = parseJson(res.body()) identity = jsonResponse["GetCallerIdentityResponse"]["GetCallerIdentityResult"]