コード例 #1
0
        public void Auth_Bearer_AddsCreds()
        {
            var        hh  = new MockHttpHelper("dummyuri");
            HttpHelper sut = hh;

            sut.AddBearerAuthHeader("secret");

            var s = hh.GetHeaderValue("Authorization");

            Assert.Contains("Bearer", s);
            Assert.Contains("secret", s);  // cant contain it in plain text.
        }
コード例 #2
0
        private static async Task <string> SaveQuestion(string s)
        {
            HttpHelper hh = new HttpHelper("https://www.hackerrank.com/x/api/v1/");

            hh.AddBearerAuthHeader("9674c8fdc7a43b8ef9662879c20063d89a9fc507484e23afc0ac90359c027e8e");
            hh.Stem = "questions/";
            var f = await hh.Execute("", s, HttpMethod.Post);

            return(f.ResponseText);

            throw new NotImplementedException();
        }
コード例 #3
0
        private static async Task <string> GetQuestionById(int v)
        {
            HttpHelper hh = new HttpHelper("https://www.hackerrank.com/x/api/v1/");

            hh.AddBearerAuthHeader("9674c8fdc7a43b8ef9662879c20063d89a9fc507484e23afc0ac90359c027e8e");
            hh.Stem = "questions/";
            var wcr = await hh.Execute("232646");


            return(wcr.ResponseText);

            throw new NotImplementedException();
        }