Skip to content

Commit

Permalink
W-13680300 Add protobuf support
Browse files Browse the repository at this point in the history
  • Loading branch information
slodha committed Jul 13, 2023
1 parent ee6c04e commit 6290b2a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected void doGet( HttpServletRequest req, HttpServletResponse res )
String query = req.getParameter( "query" );
boolean randomTest = req.getParameter("randomTest") != null;

boolean protobuf = "carbonapi_v3_pb".equals( format );
boolean protobuf = "protobuf".equals( format );
boolean json = "json".equals(format);
if( json )
{
Expand All @@ -93,15 +93,6 @@ else if ( protobuf )
{
LOG.info( "carbonapi request: found protobuf request" );
res.setContentType( "application/protobuf" );

StringBuilder sb = new StringBuilder();
BufferedReader reader = req.getReader();
String line;
while ((line = reader.readLine()) != null) {
sb.append(line);
}
String requestBody = sb.toString();
query = requestBody;
LOG.info( "carbonapi request: query: " + query + " --- blacklist: " + queryBlacklist );
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected void doGet( HttpServletRequest req, HttpServletResponse res )

boolean randomTest = req.getParameter("randomTest") != null;

boolean protobuf = "carbonapi_v3_pb".equals( format );
boolean protobuf = "protobuf".equals( format );
boolean json = "json".equals( format );
if( json )
{
Expand All @@ -104,21 +104,6 @@ else if ( protobuf )
res.setContentType( "application/protobuf" );
// target = req.getParameter( "query" );
LOG.info( "carbonapi request: target from param: " + target + " --- blacklist: " + queryBlacklist );

if ( target == null )
{
LOG.info( "Target param not set. Reading from request body..." );
StringBuilder sb = new StringBuilder();
BufferedReader reader = req.getReader();
String line;
while ( ( line = reader.readLine() ) != null )
{
sb.append( line );
}
String requestBody = sb.toString();
target = requestBody;
}
LOG.info( "carbonapi request: targe from body: " + target + " --- blacklist: " + queryBlacklist );
}
else
{
Expand Down

0 comments on commit 6290b2a

Please sign in to comment.