This is an automated email from the ASF dual-hosted git repository.

jensg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new cd2fae0  THRIFT-5373 HTTP status in case of Protocol/Transport 
exceptions Client: netstd Patch: Jens Geyer
cd2fae0 is described below

commit cd2fae091b9bafd0977ef290f722532c36a64d2e
Author: Jens Geyer <[email protected]>
AuthorDate: Thu Mar 18 16:50:39 2021 +0100

    THRIFT-5373 HTTP status in case of Protocol/Transport exceptions
    Client: netstd
    Patch: Jens Geyer
---
 lib/netstd/Thrift/Transport/Server/THttpServerTransport.cs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/netstd/Thrift/Transport/Server/THttpServerTransport.cs 
b/lib/netstd/Thrift/Transport/Server/THttpServerTransport.cs
index 7271f50..dd30d3d 100644
--- a/lib/netstd/Thrift/Transport/Server/THttpServerTransport.cs
+++ b/lib/netstd/Thrift/Transport/Server/THttpServerTransport.cs
@@ -116,7 +116,12 @@ namespace Thrift.Transport.Server
             catch (TTransportException)
             {
                 if (!context.Response.HasStarted)  // if something goes bust, 
let the client know
-                    context.Response.StatusCode = 500;
+                    context.Response.StatusCode = 500;   // internal server 
error
+            }
+            catch (TProtocolException)
+            {
+                if (!context.Response.HasStarted)  // if something goes bust, 
let the client know
+                    context.Response.StatusCode = 400;   // bad request, e.g. 
required field missing
             }
             finally
             {

Reply via email to