Skip to content

Commit

Permalink
Merge pull request #74 from ShipEngine/jpill/increase-timeout-to-60s
Browse files Browse the repository at this point in the history
fix: update default timeout to 60s
  • Loading branch information
jpill authored Jan 12, 2024
2 parents bd68b76 + de4308d commit 24e08bf
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,10 @@ Set casing of letter label layout enum

### Fixed

CreateLabelFromShipmentDetails parameters causing problems when unused has been made optional.
CreateLabelFromShipmentDetails parameters causing problems when unused has been made optional.

## 1.1.5

### Changed

Update default timeout to 60s
4 changes: 2 additions & 2 deletions ShipEngine.Tests/ConfigTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ public async void ValidateDefaultTimeoutTest()
var request = new HttpRequestMessage(HttpMethod.Put, $"v1/labels/se-1234/void");


// Verify that the client has a default timeout of 5 seconds when called.
// Verify that the client has a default timeout of 60 seconds when called.
mockHandler
.Setup(x => x.SendHttpRequestAsync<Result>
(
It.IsAny<HttpMethod>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.Is<HttpClient>(client =>
client.Timeout == TimeSpan.FromSeconds(5) &&
client.Timeout == TimeSpan.FromSeconds(60) &&
client.DefaultRequestHeaders.ToString().Contains(apiKeyString)),
It.IsAny<Config>()

Expand Down
8 changes: 4 additions & 4 deletions ShipEngine/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class Config

/// <summary>
/// The timespan to wait before the request times out.
/// Defaults to 5 seconds.
/// Defaults to 60 seconds.
/// </summary>
public readonly TimeSpan Timeout;

Expand All @@ -28,8 +28,8 @@ public class Config
/// Configure the global settings for the ShipEngine SDK.
/// </summary>
/// <param name="apiKey">The api key associated with the account you wish to use.</param>
/// <param name="timeout">The timespan to wait before the request times out. Defaults to 5 seconds</param>
/// <param name="retries">The number of retries to attempt after a failed request. Defaults t o1</param>
/// <param name="timeout">The timespan to wait before the request times out. Defaults to 60 seconds</param>
/// <param name="retries">The number of retries to attempt after a failed request. Defaults to 1</param>
public Config(string apiKey, TimeSpan? timeout = null, int retries = 1)
{
if (apiKey == null || apiKey == "")
Expand All @@ -47,7 +47,7 @@ public Config(string apiKey, TimeSpan? timeout = null, int retries = 1)
throw new ShipEngineException(message, ErrorSource.Shipengine, ErrorType.Validation, ErrorCode.InvalidFieldValue);
}

Timeout = timeout ?? TimeSpan.FromSeconds(5);
Timeout = timeout ?? TimeSpan.FromSeconds(60);

if (retries < 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public class Params
/// <summary>
/// The labelId of the original (outgoing) label that the return label is for. This associates the two labels together, which is required by some carriers.
/// </summary>
#nullable enable
#nullable enable
public string? OutboundLabelId { get; set; }
#nullable disable
#nullable disable

/// <summary>
/// The possible validate address values
Expand Down
2 changes: 1 addition & 1 deletion ShipEngine/ShipEngine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PackageId>ShipEngine</PackageId>
<PackageTags>sdk;rest;api;shipping;rates;label;tracking;cost;address;validation;normalization;fedex;ups;usps;</PackageTags>

<Version>1.1.4</Version>
<Version>1.1.5</Version>
<Authors>ShipEngine</Authors>
<Company>ShipEngine</Company>
<Summary>The official ShipEngine C# SDK for .NET</Summary>
Expand Down

0 comments on commit 24e08bf

Please sign in to comment.