【问题标题】:Argo workflow curl doesn't return http codeArgo 工作流 curl 不返回 http 代码
【发布时间】:2021-10-22 09:35:05
【问题描述】:

我有 Argo 工作流程

script:
  image: curlimages/curl:latest
  command:
    - sh
  source: >
    http_response=$(curl -X DELETE -w "%{http_code}" -o /mnt/out/rest_output.txt https://myurl/{{workflow.parameters.id}} -H "Authorization:Bearer {{inputs.parameters.token}}")
    echo $http_response > /mnt/out/http_response.txt
  volumeMounts:
    - name: out
      mountPath: /mnt/out
volumes:
  - name: out
    emptyDir: { }

调用 REST 服务。 问题是即使服务在 curlimage 中返回 400,http_response 也会返回空字符串。 可能是什么问题? 提前致谢。

【问题讨论】:

    标签: curl http-headers argo-workflows


    【解决方案1】:

    我发现了魔法。当我重写这样的命令时

    echo $(curl -X DELETE -w "%{http_code}" -o /mnt/out/rest_output.txt https://myurl/{{workflow.parameters.id}} -H "Authorization:Bearer {{inputs.parameters.token}}") > /mnt/out/http_response.txt
    

    http 代码出现在输出中。

    【讨论】:

      猜你喜欢
      • 2022-08-16
      • 1970-01-01
      • 2021-07-14
      • 2020-12-07
      • 2022-07-07
      • 2011-05-29
      • 1970-01-01
      • 2015-12-02
      • 2020-08-29
      相关资源
      最近更新 更多