File tree 3 files changed +11
-6
lines changed
3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,8 @@ public async Task TestAuth()
106
106
{
107
107
var client = ThirdwebClient . Create ( clientId : "hi" , fetchTimeoutOptions : new TimeoutOptions ( rpc : 60000 ) ) ;
108
108
var rpc = ThirdwebRPC . GetRpcInstance ( client , 1 ) ;
109
- _ = await Assert . ThrowsAsync < HttpRequestException > ( async ( ) => await rpc . SendRequestAsync < string > ( "eth_blockNumber" ) ) ;
109
+ var ex = await Assert . ThrowsAsync < HttpRequestException > ( async ( ) => await rpc . SendRequestAsync < string > ( "eth_blockNumber" ) ) ;
110
+ Assert . Contains ( "Unauthorized" , ex . Message ) ;
110
111
}
111
112
112
113
[ Fact ( Timeout = 120000 ) ]
Original file line number Diff line number Diff line change @@ -71,12 +71,12 @@ public async Task DownloadTest_Base64Uri()
71
71
}
72
72
73
73
[ Fact ( Timeout = 120000 ) ]
74
- public async Task DownloadTest_400 ( )
74
+ public async Task DownloadTest_404 ( )
75
75
{
76
76
var client = ThirdwebClient . Create ( secretKey : this . SecretKey ) ;
77
- var exception = await Assert . ThrowsAsync < Exception > ( ( ) => ThirdwebStorage . Download < string > ( client , "https://0.rpc.thirdweb. com/" ) ) ;
77
+ var exception = await Assert . ThrowsAsync < Exception > ( ( ) => ThirdwebStorage . Download < string > ( client , "https://example. com/invalid-file " ) ) ;
78
78
Assert . Contains ( "Failed to download" , exception . Message ) ;
79
- Assert . Contains ( "400 " , exception . Message ) ;
79
+ Assert . Contains ( "404 " , exception . Message ) ;
80
80
}
81
81
82
82
[ Fact ( Timeout = 120000 ) ]
Original file line number Diff line number Diff line change @@ -181,8 +181,12 @@ private async Task SendBatchAsync(List<RpcRequest> batch)
181
181
throw new HttpRequestException ( errorDetail ) ;
182
182
}
183
183
184
- var responseJson = await response . Content . ReadAsStringAsync ( ) . ConfigureAwait ( false ) ;
185
- var responses = JsonConvert . DeserializeObject < List < RpcResponse < object > > > ( responseJson ) ;
184
+ var responseContent = await response . Content . ReadAsStringAsync ( ) . ConfigureAwait ( false ) ;
185
+ if ( responseContent . Equals ( "Unauthorized" , StringComparison . OrdinalIgnoreCase ) )
186
+ {
187
+ throw new HttpRequestException ( "Unauthorized" ) ;
188
+ }
189
+ var responses = JsonConvert . DeserializeObject < List < RpcResponse < object > > > ( responseContent ) ;
186
190
187
191
foreach ( var rpcResponse in responses )
188
192
{
You can’t perform that action at this time.
0 commit comments