Skip to content

lizhe19/Test

Repository files navigation

http: enabled: false input: http_server: address: 0.0.0.0:61210 allowed_verbs: - POST - GET path: / rate_limit: "" timeout: 60s sync_response: headers:
Content-Type: application/text;charset=utf-8 status: "200"

pipeline: processors: - mapping: | let body = content().string().catch(null) meta request_body = $body let body = this.catch(null) let factoryNo = if $body.werks != null && $body.werks != "" { $body.werks } else if $body.WERKS != null && $body.WERKS != "" { $body.WERKS } else if $body.factoryNo != null && $body.factoryNo != "" { $body.factoryNo } meta factoryNo = $factoryNo meta F0001 = "172.32.6.25" meta F0002 = "172.32.6.184" meta dynamic_host = if $factoryNo == "F0001" {@F0001} else if $factoryNo == "F0002" {@F0002} - log: level: INFO message: 'dynamic_host is ${!meta("dynamic_host")}' - switch: - check: '@http_server_request_path == "/platform/api/PbomAync"' processors: - mapping: | root = content().string().catch(null) - log: level: INFO message: 'factoryNo is ${!meta("factoryNo")},http to factoryNo' - log: level: INFO message: '入站接口[/platform/api/PbomAync]一次请求记录时间:${!now().ts_format("2006-01-02 15:04:05")}' - branch: processors: - log: level: INFO message: '出站接口[http://172.21.222.12:9356/test/xml]一次请求记录时间:${!now().ts_format("2006-01-02 15:04:05")}' - http: headers: Content-Type: application/xml url: http://172.21.222.12:9356/test/xml verb: POST timeout: 30s retry_period: 1s retries: 3 - catch: - log: level: ERROR message: "调用接口失败,请求体=${!content()}" - mapping: | let status = metadata("http_status_code") let rbody = metadata("request_body") root.code = -1 root.message = if $status != 200 { "调用接口失败" } result_map: | root = content().string().catch(null) - mapping: | let request_body = metadata("request_body").parse_json().catch(null)

output: sync_response: headers: Content-Type: application/json status: "200"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages