예제 #1
0
        public HttpJsonContent(JsonKeyValuePairs json) : base()
        {
            var body = json.Stringify();

            this.content     = Encoding.UTF8.GetBytes(body);
            this.ContentType = "application/json";
        }
예제 #2
0
파일: Jwt.cs 프로젝트: kboronka/http-pack
        public Jwt(JsonKeyValuePairs payload, string secret)
        {
            var header = CreateJwtHeader();

            var jwt = Base64UrlEncode(header.Stringify()) + "." + Base64UrlEncode(payload.Stringify());

            jwt += "." + Sign(jwt, secret);

            Token = jwt;
        }
예제 #3
0
        public HttpExceptionContent(Exception ex) : base()
        {
            var inner = ExceptionHelper.GetInner(ex);
            var json  = new JsonKeyValuePairs
            {
                { "message", inner.Message },
                { "stackTrace", ExceptionHelper.GetStackTrace(inner) }
            };

            var body = json.Stringify();

            this.content     = Encoding.UTF8.GetBytes(body);
            this.ContentType = "application/json";
        }
예제 #4
0
 public FetchResponse <T> Post(string url, JsonKeyValuePairs json, string authorization)
 {
     return(Fetch(url, "POST", json.Stringify(), authorization, "application/json"));
 }