Example #1
0
        public void TestJsonBody()
        {
            JsonBody body = new JsonBody();

            Assert.Null(body.GetBody());
            body.AddParameter(new { id = 1 });
            Assert.True(body.GetBody().Length > 0);
        }
        /// <summary>
        /// 设置json数据
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public INoneBodyBuilder Body(object parameters)
        {
            var body = new JsonBody();

            body.AddParameter(parameters);
            _requestBody = body;
            ContentType("application/json");
            return(this);
        }