[TOC]
# HTTP Header Exists(未校验)
HTTP Header存在断言检查请求或响应中是否存在您指定名称的Header。
>[warning]本断言适用于在响应中接收HTTP消息的测试步骤和虚拟API。
## 适用场景
你可以在ReadyAPI套件的不同应用程序中使用此断言。根据应用程序的不同,断言验证以下数据:
| 应用 | 检查数据 | 更多信息 |
| --- | --- | --- |
| [SoapUI](https://support.smartbear.com/readyapi/docs/soapui/intro/about.html) | request 和 response Header | [SoapUI断言](https://support.smartbear.com/readyapi/docs/testing/assertions/soap.html) |
| [Secure ](https://support.smartbear.com/readyapi/docs/secure/intro/about.html) | response Header | [Security 断言](https://support.smartbear.com/readyapi/docs/secure/assertions.html) |
| [ServiceV](https://support.smartbear.com/readyapi/docs/servicev/intro/about.html) | response Header | [ServiceV断言](https://support.smartbear.com/readyapi/docs/servicev/validating/assertions.html) |
## 创建断言
1、在对话框的左边,选择 **Compliance, Status and Standards** 类别。
2、在对话框的右边,选择 **HTTP Header Exists** 。
3、点击 **Add** 。
**SoapUI**
![SoapUI:The assertions Panel](https://support.smartbear.com/readyapi/docs/_images/testing/assertions/reference/create-soap.png)
**Secure**
![Secure:The assertions Panel](https://support.smartbear.com/readyapi/docs/_images/testing/assertions/reference/create-secure.png)
**ServiceV**
![ServiceV:The assertions Panel](https://support.smartbear.com/readyapi/docs/_images/testing/assertions/reference/create-servicev.png)
## 设置断言
指定Header名称。若要检查多个Header,请添加更多的Header存在断言。
![ReadyAPI:Configuring the HTTP Header Exists assertion](https://support.smartbear.com/readyapi/docs/_images/testing/assertions/reference/compliance/header-exists.png)
## 状态代码和Header的其他断言
您可能需要为HTTP状态代码和响应Header添加更多的断言:
● [无效HTTP状态码断言](https://support.smartbear.com/readyapi/docs/testing/assertions/reference/compliance/http-invalid.html)
● [有效HTTP状态码断言](https://support.smartbear.com/readyapi/docs/testing/assertions/reference/compliance/http-valid.html)
● [HTTP Header等于断言](https://support.smartbear.com/readyapi/docs/testing/assertions/reference/compliance/header-equals.html)
**参考资料**
[1、ReadyAPI Documentation / Testing APIs / Verifying Results / Assertion Reference / Compliance Assertions / HTTP Header Exists](https://support.smartbear.com/readyapi/docs/index.html)
---
:-: --- 贡献者名单(排名不分先后) ---
:-: **材料**
:-: **编写**
苏娟
:-: **校验**
:-: **支持**
- 基础知识
- 属性
- 属性分类
- 属性扩展
- Get Data 对话框
- 断言
- 关于断言
- 使用断言
- 断言类型
- Response SLA
- Script
- Property Content Assertions
- Contains
- Equals
- Equals Binary
- JSONPath Count
- JSONPath Existence Match
- JSONPath Match
- JSONPath RegEx Match
- Message Content
- Not Contains
- XPath Match
- XQuery Match
- Compliance Assertions
- Swagger Compliance
- Schema Compliance
- HTTP Header Exists
- HTTP Header Equals
- JDBC Assertions
- 复制断言
- 术语
- 脚本
- 关于脚本
- 脚本编辑器
- JSONPath
- Projects
- SoapUI
- 测试步骤
- Groovy Script
- DataSource
- Conditional GoTo
- REST Request
- ReadyAPI
- 环境
- 关于环境
- 创建环境
- Rest Services
- Custom Properties
- JDBC Connections
- 团队协作
- 集成
- GitLab
- 第三方库
- Groovy 库
- Java 库
- 自定义ReadyAPI
- 首选项
- 全局属性
- ReadyAPI
- Code Templates
- JVM 设置
- 修改
- 实战指导
- 项目属性
- Groovy
- 代码片段
- 开发规范 v0.1
- 属性
- inbox
- FAQ
- 安装配置
- 复合工程
- 修改文件夹或文件名称