如何在Google Cloud Scheduler作业中设置内容类型

我目前有一个具有http目标和发布方法的云调度程序。

根据Google的Cloud Scheduler文档:

  

Content-Type:默认情况下,Content-Type标头设置为“ application / octet-stream”。通过在创建作业时将Content-Type显式设置为特定的媒体类型,可以覆盖默认设置。例如,可以将Content-Type设置为“ application / json”。

我几乎需要做到这一点,将Content-Type设置为“ application / json; charset = utf-8 ”,但是我看不到这样做的方法。您如何“明确地覆盖它”?

zhaopingg 回答:如何在Google Cloud Scheduler作业中设置内容类型

您可以使用CLI gcloud scheduler jobs create http <NAME>设置标题:

Windows命令行语法:

--headers="{ \"Content-Type\": \"application/json; charset=utf-8\" }"

Linux命令行语法:

--headers='{ "Content-Type": "application/json; charset=utf-8" }'

文档:

gcloud scheduler jobs create http

在此答案中,我将显示另一个示例,以便您可以看到命令中需要包含的选项:

https://stackoverflow.com/a/53182080/8016720

本文链接:https://www.f2er.com/3156886.html

大家都在问