azure-devops - Azure Devops YAML:无效的 JavaScript 属性标识符字符 yaml
问题描述
使用 Azure DevOps YAML 任务“Invoke-HTTP”,我不断得到
Exception message 'Exception Message: Invalid JavaScript property identifier character: -. Path '', line 1, position 8. (type JsonReaderException)'
这是任务的文档:
脚本如下:
jobs:
# Publish resource group artifact
- job: invoke_http_for_ase
pool: server
continueOnError: true
steps:
# Invoke REST API
# Invoke a REST API as a part of your pipeline.
- task: InvokeRESTAPI@1
displayName: 'GET Member'
inputs:
connectionType: 'connectedServiceNameARM'
azureServiceConnection: 'ARM-Service-Connection'
method: 'GET'
headers: '{Content-Type:application/json}'
urlSuffix: "subscriptions/xxx/resourceGroups/xxx?api-version=2018-05-01"
waitForCompletion: 'true'
设计师在发布管道中使用发布任务也同样有效。
解决方案
问题在于标头值必须是有效的 JSON,即属性名称和值必须用引号引起来。看到这个 github 问题
推荐阅读
- spring-boot - 如何在 redis-session 中持久化 OAuth2AuthorizedClient
- google-bigquery - Google BigQuery - WITHIN 语句的意外关键字
- xero-api - OAuth2 在同意阶段失败
- html - 覆盖 div(添加的 css)不覆盖在 ion-content 内节奏的 Ionic 标题栏
- javascript - 激活和定位预订表格的滑块价格范围
- php - 在PHP中分配给变量时定义类的值
- c - free():在 tcache 2 中检测到双重空闲 - c realloc 错误
- http-headers - 著名的 HPACK 演示图错了吗?
- vue.js - 如何布局 Vue,使页面包含标题/导航,但能够显示独立页面,例如注册
- java - 使用 Java/Groovy 连接大型机?