tzssangglass commented on code in PR #8205:
URL: https://github.com/apache/apisix/pull/8205#discussion_r1016639185


##########
t/plugin/google-cloud-logging.t:
##########
@@ -31,6 +31,61 @@ add_block_preprocessor(sub {
     if (!defined $block->request) {
         $block->set_value("request", "GET /t");
     }
+     my $http_config = $block->http_config // <<_EOC_;
+server {
+        listen 12001;
+
+        location /google-cloud-logging/test {
+            content_by_lua_block {
+                ngx.req.read_body()
+                local data = ngx.req.get_body_data()
+                ngx.log(ngx.WARN, "google cloud logging request body: ", data)
+                ngx.log(ngx.ERR, data)
+                ngx.say('test-http-logger-response')
+                ngx.log(ngx.WARN, "loggingBody:", data)
+            }
+        }
+
+
+        location /google/logging/entries {
+            content_by_lua_block {
+                ngx.req.read_body()
+                local body = ngx.req.get_body_data()
+
+                local data, err = require("cjson").decode(body)
+                if err then
+                    ngx.log(ngx.WARN, "loggingBody", body)
+                end
+
+                ngx.log(ngx.WARN, "loggingBody", body)
+                ngx.say("ok")
+                 ngx.print(body)
+            }
+        }
+
+         location /google/logging/test1 {
+            content_by_lua_block {
+                ngx.req.read_body()
+                local json_decode = require("toolkit.json").decode
+                local json_encode = require("toolkit.json").encode
+                local data = ngx.req.get_body_data()
+                local decoded_data = json_decode(data)
+
+                ngx.log(ngx.WARN,"gcp logs body entries: ", 
json_encode(decoded_data["entries"][1]["jsonPayload"]))
+                ngx.say("ok")
+            }
+        }

Review Comment:
   Because it seems that only `/google/logging/entries` and 
`/google-cloud-logging/test` are used. `/google/logging/test1` is not necessary.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to