Example #1
0
        public IEnumerable <PostDto> Build(RawPostData data)
        {
            MergeCommentsWithReactions(data.Comments, data.CommentsReactions);
            MergePostsWithReactions(data.Posts, data.PostsReactions);
            MergePostsWithComments(data.Posts, data.Comments);

            return(data.Posts);
        }
        public IEnumerator TestRawJson()
        {
            var request = new HttpPostRequest("http://httpbin.org/post");

            var data = new RawPostData("{\"a\":\"b\"}", RawPostData.Types.Json);

            request.SetPostData(data);
            request.Request();

            while (!request.IsFinished)
            {
                yield return(null);
            }

            Debug.Log($"TestRawJson result:\n{request.Response.TextData}");
        }
        public IEnumerator TestRawHtml()
        {
            var request = new HttpPostRequest("http://httpbin.org/post");

            var data = new RawPostData("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\"><title>405 Method Not Allowed</title><h1>Method Not Allowed</h1><p>The method is not allowed for the requested URL.</p>", RawPostData.Types.Html);

            request.SetPostData(data);
            request.Request();

            while (!request.IsFinished)
            {
                yield return(null);
            }

            Debug.Log($"TestRawHtml result:\n{request.Response.TextData}");
        }
        public IEnumerator TestRawXml()
        {
            var request = new HttpPostRequest("http://httpbin.org/post");

            var data = new RawPostData("<my data=\"troll\"/>", RawPostData.Types.Xml);

            request.SetPostData(data);
            request.Request();

            while (!request.IsFinished)
            {
                yield return(null);
            }

            Debug.Log($"TestRawXml result:\n{request.Response.TextData}");
        }
        public IEnumerator TestRawJavascript()
        {
            var request = new HttpPostRequest("http://httpbin.org/post");

            var data = new RawPostData("console.log('asdf');", RawPostData.Types.Javascript);

            request.SetPostData(data);
            request.Request();

            while (!request.IsFinished)
            {
                yield return(null);
            }

            Debug.Log($"TestRawJavascript result:\n{request.Response.TextData}");
        }