eces / select

🚀 Fast build tool for admin/backoffice by YAML declarative way.
https://dev.selectfromuser.com
Other
28 stars 3 forks source link

Fix query param #2

Closed eces closed 2 years ago

eces commented 2 years ago

httpblock test yml

- type: http
  name: POST yml request + json params <String> replacement
  axios:
    method: POST
    url: https://httpbin.org/anything
    data: >
      {
        "id": "{{id}}"
      }
    headers: >
      {
        "X-Custom-Header": "Token {{id}}"
      }
    params: >
      { 
        "added_cid": "added-{{id}}"
      }
  params:
    - key: id
      label: '고객ID (수신거부 대상자 처리)'
      format: 'number'

- type: http
  name: POST yml request + yml params <String> replacement
  axios:
    method: POST
    url: https://httpbin.org/anything
    data:
      id: "{{id}}"
    headers:
      X-Custom-Header: Token {{id}}
    params:
      added_cid: added-{{id}}
  params:
    - key: id
      label: '고객ID (수신거부 대상자 처리)'
      format: 'number'

api test yml

- type: query
  resource: mysql.qa
  # autoload: true
  name: 회원목록
  sql: > 
    SELECT id, email, provider_kakao_id, created_at, last_signed_at 
    FROM user
    :orderby
  params:
    - key: orderby
      label: '정렬'
      raw: true
      dropdown:
        - ORDER BY last_signed_at DESC, created_at ASC
        - ORDER BY id DESC
        - ORDER BY id ASC
      dropdown_labels:
        - 최근로그인
        - 최근아이디
        - 마지막아이디
eces commented 2 years ago

Tested more deep params

- type: http
  name: POST yml request + yml params <String> replacement
  axios:
    method: POST
    url: https://httpbin.org/anything
    data:
      id: "{{id}}"
      rows: 
        - id: id-{{id}}
        - paramsInKey{{id}}: value
    headers:
      X-Custom-Header: Token {{id}}
    params:
      added_cid: added-{{id}}
  params:
    - key: id
      label: '고객ID (수신거부 대상자 처리)'
      format: 'number'

response

{
  "args": {
    "added_cid": "added-826403"
  },
  "data": "{\"id\":\"826403\",\"rows\":[{\"id\":\"id-826403\"},{\"paramsInKey826403\":\"value\"}]}",
  "files": {},
  "form": {},
  "headers": {
    "Accept": "application/json, text/plain, */*",
    "Content-Length": "73",
    "Content-Type": "application/json",
    "Host": "httpbin.org",
    "User-Agent": "SelectAdmin",
    "X-Amzn-Trace-Id": "Root=1-61a8e2e1-5b79c8337457fa5b498f8f30",
    "X-Custom-Header": "Token 826403"
  },
  "json": {
    "id": "826403",
    "rows": [
      {
        "id": "id-826403"
      },
      {
        "paramsInKey826403": "value"
      }
    ]
  },
  "method": "POST",
  "origin": "14.138.143.156",
  "url": "https://httpbin.org/anything?added_cid=added-826403"
}
eces commented 2 years ago

Updated document pages:

eces commented 2 years ago

Need bump version