コード例 #1
0
        public Request Bind(string button = null)
        {
            string charset = GetCharset();
            Uri    action  = Action;

            if (!MethodDescription.GetMethod(Method).BodyAllowed&& EncodingType == MediaType.ApplicationFormUrlEncoded)
            {
                action = Action.AddQueryParameters(GetSubmitData(button));
            }

            Request request = Session.Bind(action)
                              .ContentType(EncodingType)
                              .Method(Method);

            if (MethodDescription.GetMethod(Method).BodyAllowed)
            {
                request.Body(GetSubmitData(button));
            }

            if (charset != null)
            {
                request.CodecParameter("Charset", charset);
            }

            return(request);
        }