From 75ae527a90c28effc47df1faf4dda48d86b8f980 Mon Sep 17 00:00:00 2001 From: Nikolay-parhimovich <32815300+Nikolay-parhimovich@users.noreply.github.com> Date: Fri, 23 Oct 2020 18:01:26 +0300 Subject: [PATCH] Fix issue #36999 (#43723) * Created two resources string for exceptions. Replaced static strings with resource. * Fixed formatting. Co-authored-by: Nikolay-parhimovich <> --- src/libraries/System.Net.Http/src/Resources/Strings.resx | 6 ++++++ .../src/System/Net/Http/BrowserHttpHandler/BrowserHttpHandler.cs | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Net.Http/src/Resources/Strings.resx b/src/libraries/System.Net.Http/src/Resources/Strings.resx index a5f53f1..a85ef7c 100644 --- a/src/libraries/System.Net.Http/src/Resources/Strings.resx +++ b/src/libraries/System.Net.Http/src/Resources/Strings.resx @@ -606,4 +606,10 @@ The user-supplied PlaintextStreamFilter returned null. + + Internal error marshalling the response Promise from `fetch`. + + + Synchronous reads are not supported, use ReadAsync instead. + diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/BrowserHttpHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/BrowserHttpHandler.cs index f4aa20a..5331207 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/BrowserHttpHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/BrowserHttpHandler.cs @@ -247,7 +247,7 @@ namespace System.Net.Http var response = s_fetch?.Invoke("apply", s_window, args) as Task; args.Dispose(); if (response == null) - throw new Exception("Internal error marshalling the response Promise from `fetch`."); + throw new Exception(SR.net_http_marshalling_response_promise_from_fetch); JSObject t = (JSObject)await response.ConfigureAwait(continueOnCapturedContext: true); @@ -562,7 +562,7 @@ namespace System.Net.Http public override int Read(byte[] buffer, int offset, int count) { - throw new NotSupportedException("Synchronous reads are not supported, use ReadAsync instead"); + throw new NotSupportedException(SR.net_http_synchronous_reads_not_supported); } public override long Seek(long offset, SeekOrigin origin) -- 2.7.4