美文网首页node
Node.js 模块:http-assert

Node.js 模块:http-assert

作者: 独木舟的木 | 来源:发表于2020-01-08 15:50 被阅读0次

http-assert

assert with status codes.

API

此模块的 API 被设计为和 Node.js 的 assert 模块相似。

当断言失败时,每个函数都会抛出一个 http-errors 模块下的 HttpError 实例。

assert(value, [status], [message], [properties])

测试 value 值是否为真。如果 value 值为假,一个带有给定 statusmessageproperties 属性的 HttpError 实例会被抛出。

assert.ok(value, [status], [message], [properties])

测试 value 值是否为真。如果 value 值为假,一个带有给定 statusmessageproperties 属性的 HttpError 实例会被抛出。

assert.deepEqual(a, b, [status], [message], [properties])

测试 ab 是否全等。原始值会通过相等操作符( == )进行比较。如果 ab 不相等,一个带有给定 statusmessageproperties 属性的 HttpError 实例会被抛出。

assert.notDeepEqual(a, b, [status], [message], [properties])

测试 ab 之间的全等性。原始值会通过相等操作符( == )进行比较。如果 ab 相等,一个带有给定 statusmessageproperties 属性的 HttpError 实例会被抛出。

assert.equal(a, b, [status], [message], [properties])

使用相等操作符( == )测试 ab 之间的浅的、强制性相等。如果 ab 不相等,一个带有给定 statusmessageproperties 属性的 HttpError 实例会被抛出。

assert.notEqual(a, b, [status], [message], [properties])

使用相等操作符( == )测试 ab 之间的浅的、强制性相等。如果 ab 相等,一个带有给定 statusmessageproperties 属性的 HttpError 实例会被抛出。

assert.strictEqual(a, b, [status], [message], [properties])

使用全等操作符( === )测试 ab 是否严格相等。如果 ab 不相等,一个带有给定 statusmessageproperties 属性的 HttpError 实例会被抛出。

assert.notStrictEqual(a, b, [status], [message], [properties])

使用全等操作符( === )测试 ab 是否严格相等。如果 ab 相等,一个带有给定 statusmessageproperties 属性的 HttpError 实例会被抛出。

相关文章

  • Node.js 模块:http-assert

    http-assert assert with status codes. API 此模块的 API 被设计为和 ...

  • 关于node.js一些模块的记录「FS模块」

    目录 Node.JS教程 FS模块 Path模块 FS模块 Path模块 Node.js path 模块提供了一些...

  • 5-创建及发布node.js模块

    创建node.js模块node.js模块是可以发布在npm上的package,当你要创建一个node.js模块时,...

  • Node.js HTTP模块

    内置HTTP模块 Node.js 中有 HTTP 这个内置模块,HTTP 模块允许 Node.js 通过超文本传输...

  • Node.js模块

    Node.js 模块和 Node.js 包介绍。 一、Node.js模块 每一个Node.js都是一个Node.j...

  • Node.js与内置模块

    目录: 认识Node.js fs文件系统模块 path路径模块 http模块 认识Node.js 为啥JavaSc...

  • Node学习(6)--模块系统

    Node.js模块系统 为了让Node.js的文件可以相互调用,Node.js提供了一个简单的模块系统。模块是No...

  • node.js - 基础之module

    1. node.js模块概述 为了让node.js的文件可以相互调用,node.js提供了一个简单的模块系统。模块...

  • 6-1 Node.js 模块

    Node.js 的模块 为了让Node.js的文件可以相互调用,Node.js提供了一个简单的模块系统。模块是No...

  • node.js(十一)

    Node.js模块系统为了让Node.js的文件可以相互调用,Node.js提供了一个简单的模块系统。模块是Nod...

网友评论

    本文标题:Node.js 模块:http-assert

    本文链接:https://www.haomeiwen.com/subject/ypjsactx.html