Go to the documentation of this file.
   26 #include "absl/strings/str_format.h" 
   37                                   const char* request_text,
 
   38                                   const char* expect_method,
 
   41                                   const char* expect_body, ...) {
 
   56   for (
i = 0; 
i < num_slices; 
i++) {
 
   68   if (expect_body != 
nullptr) {
 
   75   va_start(
args, expect_body);
 
   80     expect_key = va_arg(
args, 
char*);
 
   81     if (!expect_key) 
break;
 
   83     expect_value = va_arg(
args, 
char*);
 
   98                           const char* response_text, 
int expect_status,
 
   99                           const char* expect_body, ...) {
 
  114   for (
i = 0; 
i < num_slices; 
i++) {
 
  123   if (expect_body != 
nullptr) {
 
  130   va_start(
args, expect_body);
 
  135     expect_key = va_arg(
args, 
char*);
 
  136     if (!expect_key) 
break;
 
  138     expect_value = va_arg(
args, 
char*);
 
  153                        const char* response_text) {
 
  168   for (
i = 0; 
i < num_slices; 
i++) {
 
  186                                const char* request_text) {
 
  201   for (
i = 0; 
i < num_slices; 
i++) {
 
  218 int main(
int argc, 
char** argv) {
 
  228                   "HTTP/1.0 200 OK\r\n" 
  232                   200, 
"hello world!", 
"xyz", 
"abc", NULL);
 
  234                   "HTTP/1.0 404 Not Found\r\n" 
  238                   "HTTP/1.1 200 OK\r\n" 
  242                   200, 
"hello world!", 
"xyz", 
"abc", NULL);
 
  249                   "HTTP/1.1 200 OK\r\n" 
  250                   "Transfer-Encoding: chunked\r\n" 
  254                   "16;param1;param2\r\n" 
  255                   " is a chunked encoding\r\n" 
  257                   " example.\r\nNo params handled.\r\n" 
  261                   "This is a chunked encoding example.\r\nNo params handled.",
 
  262                   "Transfer-Encoding", 
"chunked", NULL);
 
  264                   "HTTP/1.1 200 OK\r\n" 
  265                   "Transfer-Encoding: chunked\r\n" 
  270                   "are also supported.\r\n" 
  274                   200, 
"HTTP Trailers are also supported.", 
"Transfer-Encoding",
 
  275                   "chunked", 
"abc", 
"xyz", NULL);
 
  309     test_fails(split_modes[
i], 
"HTTP/1.0 000 XYX\r\n");
 
  312     test_fails(split_modes[
i], 
"HTTP/1.0 200 OK\r\nFoo x\r\n");
 
  314                "HTTP/1.0 200 OK\r\n" 
  
GPRAPI void grpc_slice_unref(grpc_slice s)
@ GRPC_SLICE_SPLIT_IDENTITY
return memset(p, 0, total)
ABSL_MUST_USE_RESULT std::string StrFormat(const FormatSpec< Args... > &format, const Args &... args)
grpc_error_handle grpc_http_parser_eof(grpc_http_parser *parser)
GPRAPI grpc_slice grpc_slice_from_copied_string(const char *source)
GPRAPI void gpr_free(void *ptr)
GPRAPI void * gpr_malloc(size_t size)
static void test_request_succeeds(grpc_slice_split_mode split_mode, const char *request_text, const char *expect_method, grpc_http_version expect_version, const char *expect_path, const char *expect_body,...)
void grpc_http_request_destroy(grpc_http_request *request)
void grpc_http_response_destroy(grpc_http_response *response)
void grpc_http_parser_destroy(grpc_http_parser *)
static void test_succeeds(grpc_slice_split_mode split_mode, const char *response_text, int expect_status, const char *expect_body,...)
#define GPR_ARRAY_SIZE(array)
void grpc_split_slices(grpc_slice_split_mode mode, grpc_slice *src_slices, size_t src_slice_count, grpc_slice **dst_slices, size_t *dst_slice_count)
grpc_error_handle grpc_http_parser_parse(grpc_http_parser *parser, const grpc_slice &slice, size_t *start_of_body)
void grpc_http_parser_init(grpc_http_parser *parser, grpc_http_type type, void *request_or_response)
#define GRPC_HTTP_PARSER_MAX_HEADER_LENGTH
#define GRPC_ERROR_UNREF(err)
int main(int argc, char **argv)
static void test_request_fails(grpc_slice_split_mode split_mode, const char *request_text)
GRPCAPI void grpc_init(void)
static void test_fails(grpc_slice_split_mode split_mode, const char *response_text)
@ GRPC_SLICE_SPLIT_ONE_BYTE
GRPCAPI void grpc_shutdown(void)
#define GRPC_ERROR_IS_NONE(err)
grpc
Author(s): 
autogenerated on Fri May 16 2025 02:59:40