Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

网关无法支持接口返回为数组类型 #79

Closed
linzhiqiang0514 opened this issue Mar 12, 2021 · 1 comment · Fixed by #81
Closed

网关无法支持接口返回为数组类型 #79

linzhiqiang0514 opened this issue Mar 12, 2021 · 1 comment · Fixed by #81
Assignees
Labels
Projects
Milestone

Comments

@linzhiqiang0514
Copy link

通过编排,县调用A接口,后调用B接口,
B接口的返回为 JsonArray类型的,配置通配符 * -> step2.request1.response.body 的时候,返回为空。
样例的配置json如下:

{
  "debug": true,
  "method": "POST",
  "validateResponse": {
    "headers": {},
    "fixedBody": {
      "msgCode": "404"
    },
    "fixedHeaders": {},
    "body": {
      "errorMsg": "string validateMsg"
    },
    "script": {}
  },
  "paramsDef": {
    "type": "object",
    "properties": {
      "password": {
        "type": "string",
        "title": "mima"
      },
      "username": {
        "type": "string",
        "title": "yonghu"
      }
    },
    "required": [
      "username"
    ]
  },
  "dataMapping": {
    "response": {
      "headers": {},
      "fixedBody": {},
      "fixedHeaders": {},
      "body": {
        "*": "string step2.request1.response.body"
      },
      "script": {}
    }
  },
  "type": "REQUEST",
  "version": 19,
  "path": "/proxytest/test/userserv/api/user/systeminfos",
  "langDef": {
    "langMapping": {
      "zh": "zh"
    },
    "langParam": ""
  },
  "headersDef": {
    "type": "object",
    "properties": {},
    "required": []
  },
  "stepConfigs": [
    {
      "stop": false,
      "dataMapping": {},
      "name": "step1",
      "requests": [
        {
          "method": "POST",
          "dataMapping": {
            "request": {
              "headers": {},
              "fixedParams": {},
              "fixedBody": {},
              "fixedHeaders": {},
              "body": {
                "*": "string input.request.body"
              },
              "params": {
                "*": "string input.request.params"
              },
              "script": {}
            },
            "response": {
              "headers": {},
              "fixedBody": {},
              "fixedHeaders": {},
              "body": {
                "*": "string step1.request1.response.body"
              },
              "script": {}
            }
          },
          "testUrl": "http://userserver:20100/userserv/oauth/token",
          "type": "REQUEST",
          "url": "http://userserver:20100/userserv/oauth/token",
          "timeout": "3000",
          "conditionFlag": false,
          "devUrl": "http://userserver:20100/userserv/oauth/token",
          "condition": {},
          "prodUrl": "http://userserver:20100/userserv/oauth/token",
          "name": "request1",
          "preUrl": "http://userserver:20100/userserv/oauth/token",
          "fallback": {
            "mode": "stop"
          }
        }
      ]
    },
    {
      "stop": false,
      "dataMapping": {},
      "name": "step2",
      "requests": [
        {
          "method": "GET",
          "dataMapping": {
            "request": {
              "headers": {
                "Authorization": {
                  "source": "function dyFunc(paramsJsonStr) {\n  var context = JSON.parse(paramsJsonStr)['context'];\n  var data = common.getStepRespBody(context, 'step1', 'request1', '');\n  var token = data['access_token'];\n  return \"bearer \" + token;\n}\n",
                  "aggregate_config_script_id": 2,
                  "type": "javascript"
                }
              },
              "fixedParams": {},
              "fixedHeaders": {},
              "params": {},
              "script": {}
            },
            "response": {
              "headers": {},
              "fixedBody": {},
              "fixedHeaders": {},
              "body": {
                "*": "string step2.request1.response.body"
              },
              "script": {}
            }
          },
          "testUrl": "http://userserver:20100/userserv/api/user/systeminfos",
          "type": "REQUEST",
          "url": "http://userserver:20100/userserv/api/user/systeminfos",
          "timeout": "3000",
          "conditionFlag": false,
          "devUrl": "http://userserver:20100/userserv/api/user/systeminfos",
          "condition": {},
          "prodUrl": "http://userserver:20100/userserv/api/user/systeminfos",
          "name": "request1",
          "preUrl": "http://userserver:20100/userserv/api/user/systeminfos",
          "fallback": {
            "mode": "stop"
          }
        }
      ]
    }
  ],
  "name": "queryuserInfo",
  "bodyDef": {
    "type": "object",
    "properties": {},
    "required": []
  },
  "id": "d9a7ce93-5cc4-43ea-9227-0cedc3d20b28",
  "scriptValidate": {}
}

dxfeng10 added a commit to dxfeng10/fizz-gateway-community that referenced this issue Mar 12, 2021
dxfeng10 added a commit to dxfeng10/fizz-gateway-community that referenced this issue Mar 15, 2021
@linwaiwai linwaiwai linked a pull request Mar 15, 2021 that will close this issue
@linwaiwai linwaiwai added this to the v1.5.0 milestone Mar 16, 2021
@linwaiwai linwaiwai added this to To do in Fizz via automation Mar 16, 2021
@dxfeng10 dxfeng10 moved this from To do to In progress in Fizz Mar 23, 2021
@dxfeng10 dxfeng10 moved this from In progress to Done in Fizz Mar 23, 2021
@linwaiwai
Copy link
Contributor

Version 1.5.0 of Fizz gateway have supported this feature.

@linwaiwai linwaiwai moved this from Done to Released in Fizz Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Fizz
Released
Development

Successfully merging a pull request may close this issue.

3 participants