aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/cpp/interop/server.cc6
-rw-r--r--test/cpp/interop/server_helper.cc8
-rw-r--r--test/cpp/interop/server_helper.h1
3 files changed, 13 insertions, 2 deletions
diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc
index 32c60aff44..6c429b3393 100644
--- a/test/cpp/interop/server.cc
+++ b/test/cpp/interop/server.cc
@@ -42,6 +42,7 @@
#include <gflags/gflags.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
+#include <grpc/support/useful.h>
#include <grpc++/config.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
@@ -67,6 +68,7 @@ using grpc::ServerReader;
using grpc::ServerReaderWriter;
using grpc::ServerWriter;
using grpc::SslServerCredentialsOptions;
+using grpc::testing::InteropServerContextInspector;
using grpc::testing::Payload;
using grpc::testing::PayloadType;
using grpc::testing::SimpleRequest;
@@ -138,6 +140,7 @@ class TestServiceImpl : public TestService::Service {
Status UnaryCall(ServerContext* context, const SimpleRequest* request,
SimpleResponse* response) {
+ InteropServerContextInspector inspector(*context);
SetResponseCompression(context, *request);
if (request->has_response_size() && request->response_size() > 0) {
if (!SetPayload(request->response_type(), request->response_size(),
@@ -145,6 +148,9 @@ class TestServiceImpl : public TestService::Service {
return Status(grpc::StatusCode::INTERNAL, "Error creating payload.");
}
}
+ const gpr_uint32 client_accept_encodings_bitset =
+ inspector.GetEncodingsAcceptedByClient();
+ gpr_log(GPR_INFO, "%d", GPR_BITCOUNT(client_accept_encodings_bitset));
return Status::OK;
}
diff --git a/test/cpp/interop/server_helper.cc b/test/cpp/interop/server_helper.cc
index 8cfed2acb5..3721d79635 100644
--- a/test/cpp/interop/server_helper.cc
+++ b/test/cpp/interop/server_helper.cc
@@ -69,8 +69,12 @@ InteropServerContextInspector::GetCallCompressionAlgorithm() const {
return grpc_call_get_compression_algorithm(context_.call_);
}
-std::shared_ptr<const AuthContext> InteropServerContextInspector::GetAuthContext()
- const {
+gpr_uint32 InteropServerContextInspector::GetEncodingsAcceptedByClient() const {
+ return grpc_call_get_encodings_accepted_by_peer(context_.call_);
+}
+
+std::shared_ptr<const AuthContext>
+InteropServerContextInspector::GetAuthContext() const {
return context_.auth_context();
}
diff --git a/test/cpp/interop/server_helper.h b/test/cpp/interop/server_helper.h
index a57ef0b3c5..7b6b12cd4d 100644
--- a/test/cpp/interop/server_helper.h
+++ b/test/cpp/interop/server_helper.h
@@ -53,6 +53,7 @@ class InteropServerContextInspector {
std::shared_ptr<const AuthContext> GetAuthContext() const;
bool IsCancelled() const;
grpc_compression_algorithm GetCallCompressionAlgorithm() const;
+ gpr_uint32 GetEncodingsAcceptedByClient() const;
private:
const ::grpc::ServerContext& context_;