空手道中的一个标题之一编辑(更新,删除)
该标头在一个.js
文件中,我正在使用
* configure headers = read('classpath:services/Headers/distheader.js')
问题#1
- 我有一个标题, 读取此标题使用我的方案数据? 我尝试设置
*标头'xyz'='value'
,但它不编辑它。
问题#2
- 如果我想删除其中一个标题,该怎么可能?
I have this header which is in a .js
file and I am reading this header using
* configure headers = read('classpath:services/Headers/distheader.js')
Question #1
- How can I edit one of the headers in this file at run-time using my scenario data?
I tried setting* header 'xyz' = 'value'
but it doesn't edit it.
Question #2
- If I want to delete one of the headers, how is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因此,90%的方案是“快乐路径”,并且您配置了
标题
JS。现在,您需要一些方案才能拥有更多(或更少的标题)。一个选项是为这些方案进行硬编码标头,请注意,您可以执行
*配置标题= null
以禁用“自动”标头。然后使用标头
(或标题
)关键字,然后手动构建标头。另一个选择是您可以调用标题功能并获取JSON-然后在设置标头手动< / em>之前突变(添加 /删除键)。例如:
因此,上面的优势是,如果您的标题例程很复杂,则可以重新使用它 - 但仍然具有细粒度的控制。
有关更多想法,请参见: https://stackoverflow.com/a/a/766672675/143475
So 90% of your scenarios are "happy path", and you have a
headers
JS configured.Now you need some scenarios to have more (or less headers). One option is to hard-code the headers for those scenarios, note that you can do
* configure headers = null
to disable the "auto" headers. Then use theheader
(orheaders
) keyword and build headers manually.Another option is that you can invoke the headers function and get a JSON - and then mutate (add / remove keys) before setting headers manually. For example:
So the advantage above is in case your headers routine is complex, you can re-use it - but still have fine-grained control.
For more ideas, see: https://stackoverflow.com/a/76672675/143475