Skip to content

Commit

Permalink
refactor(awclient, s3client, stsclient): clarify newHttpClient params
Browse files Browse the repository at this point in the history
The lack of spaces around `&` made this harder to read.

My first reading of:

    &"

is the beginning of a strformat [1] format string, but my first reading
of

    & "

is string concatenation.

[1] https://nim-lang.org/docs/strformat.html
  • Loading branch information
ee7 committed Feb 28, 2024
1 parent 48ef3bd commit 88ccdae
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion nimutils/awsclient.nim
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ proc newAwsClient*(creds: AwsCredentials, region,
let
# TODO - use some kind of template and compile-time variable to put the correct kernel used to build the sdk in the UA?
httpclient = createHttpClient(
userAgent = "nimaws-sdk/0.3.3; "&defUserAgent.replace(" ", "-").toLower&"; darwin/16.7.0",
userAgent = "nimaws-sdk/0.3.3; " & defUserAgent.replace(" ", "-").toLower() & "; darwin/16.7.0",
)
scope = AwsScope(date: getAmzDateString(), region: region, service: service)

Expand Down
6 changes: 4 additions & 2 deletions nimutils/s3client.nim
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ proc newS3Client*(creds: AwsCredentials, region: string = defaultRegion,
host: string = awsURI, timeoutMilliseconds = 1000): S3Client =
let
# TODO - use some kind of template and compile-time variable to put the correct kernel used to build the sdk in the UA?
httpclient = newHttpClient("nimaws-sdk/0.3.3; "&defUserAgent.replace(" ",
"-").toLower&"; darwin/16.7.0", timeout = timeoutMilliseconds)
httpclient = newHttpClient(
"nimaws-sdk/0.3.3; " & defUserAgent.replace(" ", "-").toLower() & "; darwin/16.7.0",
timeout = timeoutMilliseconds,
)
scope = AwsScope(date: getAmzDateString(), region: region, service: "s3")

var
Expand Down
6 changes: 4 additions & 2 deletions nimutils/stsclient.nim
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ proc newStsClient*(creds: AwsCredentials,
timeoutMilliseconds = 1000): StsClient =
let
# TODO - use some kind of template and compile-time variable to put the correct kernel used to build the sdk in the UA?
httpclient = newHttpClient("nimaws-sdk/0.3.3; "&defUserAgent.replace(" ", "-").toLower&"; darwin/16.7.0",
timeout = timeoutMilliseconds)
httpclient = newHttpClient(
"nimaws-sdk/0.3.3; " & defUserAgent.replace(" ", "-").toLower() & "; darwin/16.7.0",
timeout = timeoutMilliseconds,
)
scope = AwsScope(date: getAmzDateString(), region: region, service: "sts")

var
Expand Down

0 comments on commit 88ccdae

Please sign in to comment.