[TOC]
# HTTP Header Equals(未校验)
HTTP报头等于断言,检查报头是否存在于请求或响应中,是否具有所需的值。
>[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 Equals** 。
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)
## 设置断言
1.在 **Header** 字段中指定 header 名称。
![ReadyAPI:Configuring the HTTP Header Exists assertion](https://support.smartbear.com/readyapi/docs/_images/testing/assertions/reference/compliance/header-equals.png)
2.在 **Value** 编辑框中指定预期的 header 值。
3.选择其他选项以缩小期望值:
| 选项 | 描述 |
| --- | --- |
| **Ignore case**| 使搜索用例不区分大小写 |
| **Regular Expression**| 将输入的值视为正则表达式。要了解有关正则表达式语法的更多信息,请参见[Oracle documentation](https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)。 |
## 状态代码和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-exists.html)
**参考资料**
[1、ReadyAPI Documentation / Testing APIs / Verifying Results / Assertion Reference / Compliance Assertions / HTTP Header Equals](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
- 安装配置
- 复合工程
- 修改文件夹或文件名称