Bläddra i källkod

Json dump to body directly

ithewei 3 år sedan
förälder
incheckning
7761f909c3
1 ändrade filer med 3 tillägg och 1 borttagningar
  1. 3 1
      http/HttpMessage.h

+ 3 - 1
http/HttpMessage.h

@@ -166,7 +166,8 @@ public:
     template<typename T>
     template<typename T>
     int Json(const T& t) {
     int Json(const T& t) {
         content_type = APPLICATION_JSON;
         content_type = APPLICATION_JSON;
-        json = t;
+        hv::Json j(t);
+        body = j.dump(2);
         return 200;
         return 200;
     }
     }
     const hv::Json& GetJson() {
     const hv::Json& GetJson() {
@@ -264,6 +265,7 @@ public:
     virtual void Reset() {
     virtual void Reset() {
         Init();
         Init();
         headers.clear();
         headers.clear();
+        cookies.clear();
         body.clear();
         body.clear();
 #ifndef WITHOUT_HTTP_CONTENT
 #ifndef WITHOUT_HTTP_CONTENT
         json.clear();
         json.clear();