protected void BuildRequest <T>(BrowserContext context, T body)
 {
     context.HttpRequest();
     context.Header("Accept", "application/json");
     context.Header("Content-Type", "application/json");
     context.JsonBody(body);
 }
        public static void DataFormatBody <T>(this BrowserContext browserContext, DataFormat format, T model)
        {
            switch (format)
            {
            case DataFormat.Json:
                browserContext.JsonBody(model);
                break;

            case DataFormat.Proto:
                var    descriptor = ProtobufResponse.GetDescriptor(typeof(T));
                object value      = SimpleValue.FromValue(model);
                if (value == null)
                {
                    value = model;
                }

                var bytes = descriptor.Write(value);
                browserContext.Body(new MemoryStream(bytes), "application/x-protobuf");
                browserContext.Header("Content-Length", bytes.Length.ToString());
                break;

            default:
                throw new NotImplementedException();
            }
        }