You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "Sn0rt (via GitHub)" <gi...@apache.org> on 2023/04/17 07:12:47 UTC

[GitHub] [apisix] Sn0rt commented on a diff in pull request #9267: fix: body-transformer should have a smaller priority than proxy-cache

Sn0rt commented on code in PR #9267:
URL: https://github.com/apache/apisix/pull/9267#discussion_r1163652633


##########
t/plugin/body-transformer.t:
##########
@@ -23,9 +23,28 @@ no_root_location();
 add_block_preprocessor(sub {
     my ($block) = @_;
 
-    if (!$block->request) {
-        $block->set_value("request", "GET /t");
+    my $http_config = $block->http_config // <<_EOC_;
+
+    # for proxy cache

Review Comment:
   ok, I will remove it later



##########
t/plugin/body-transformer.t:
##########
@@ -652,3 +662,113 @@ foobar:
             assert(res.status == 200)
         }
     }
+
+
+
+=== TEST 10: cooperation of proxy-cache plugin
+--- config
+location /websamples.countryinfo/CountryInfoService.wso {

Review Comment:
   yep. this url. is genrate from a real user case.



##########
t/plugin/body-transformer.t:
##########
@@ -23,9 +23,19 @@ no_root_location();
 add_block_preprocessor(sub {
     my ($block) = @_;
 
-    if (!$block->request) {
-        $block->set_value("request", "GET /t");
+    my $http_config = $block->http_config // <<_EOC_;
+
+    lua_shared_dict memory_cache 50m;
+
+    server {
+        listen 1986;
+        server_tokens off;
+

Review Comment:
   removed, thx.



##########
t/plugin/body-transformer.t:
##########
@@ -652,3 +652,115 @@ foobar:
             assert(res.status == 200)
         }
     }
+
+
+
+=== TEST 10: cooperation of proxy-cache plugin
+--- http_config
+lua_shared_dict memory_cache 50m;
+--- config
+location /demo {
+    content_by_lua_block {
+        ngx.say([[
+    <SOAP-ENV:Envelope
+        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+    <SOAP-ENV:Header/>
+        <SOAP-ENV:Body>
+            <ns2:CapitalCityResponse
+                xmlns:ns2="http://spring.io/guides/gs-producing-web-service">
+                <ns2:CapitalCityResult>hello</ns2:CapitalCityResult>
+            </ns2:CapitalCityResponse>
+        </SOAP-ENV:Body>
+    </SOAP-ENV:Envelope>
+        ]])
+    }
+}
+
+    location /t {
+        content_by_lua_block {
+            local t = require("lib.test_admin")
+
+            local req_template = ngx.encode_base64[[
+                <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.oorsprong.org/websamples.countryinfo">
+                <soapenv:Header/>
+                <soapenv:Body>
+                    <web:CapitalCity>
+                    <web:sCountryISOCode>{{_escape_xml(country)}}</web:sCountryISOCode>
+                    </web:CapitalCity>
+                </soapenv:Body>
+                </soapenv:Envelope>
+            ]]
+
+            local rsp_template = ngx.encode_base64[[
+                {"result": {*_escape_json(Envelope.Body.CapitalCityResponse.CapitalCityResult)*}}
+                ]]
+
+            local code, body = t.test('/apisix/admin/routes/1',
+                ngx.HTTP_PUT,
+                string.format([[{
+                    "uri": "/capital",
+                    "plugins": {
+                        "proxy-rewrite": {
+                            "set": {

Review Comment:
   actually. this config is copy from a real user case. more info you find from https://github.com/apache/apisix/issues/9226



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org