Comparing version 3.3.2 to 3.3.3
{ | ||
"name": "pactum", | ||
"version": "3.3.2", | ||
"version": "3.3.3", | ||
"description": "REST API Testing Tool for all levels in a Test Pyramid", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -44,2 +44,15 @@ export type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'TRACE'; | ||
export interface InteractionCallRequest { | ||
method?: string; | ||
path?: string; | ||
query?: object; | ||
headers?: object; | ||
body?: object; | ||
} | ||
export interface InteractionCall { | ||
request?: InteractionCallRequest; | ||
exercisedAt: number; | ||
} | ||
// TODO - accept function - (req, res) | ||
@@ -59,8 +72,8 @@ export interface Interaction { | ||
stores?: object; | ||
calls?: InteractionCall[]; | ||
} | ||
export interface InteractionDetails { | ||
id: string; | ||
exercised: boolean; | ||
callCount: number; | ||
export interface InteractionDetails extends Interaction { | ||
exercised?: boolean; | ||
callCount?: number; | ||
} | ||
@@ -67,0 +80,0 @@ |
@@ -60,3 +60,3 @@ const Interaction = require('../models/Interaction.model'); | ||
for (let j = 0; j < raw.length; j++) { | ||
const interaction = new Interaction(raw[j], true); | ||
const interaction = new Interaction(raw[j]); | ||
this._server.addInteraction(interaction.id, interaction); | ||
@@ -63,0 +63,0 @@ ids.push(interaction.id); |
@@ -205,2 +205,8 @@ import { RequestOptions, IncomingMessage } from 'http'; | ||
/** | ||
* bearer token | ||
* @see https://pactumjs.github.io/api/requests/withBearerToken.html | ||
*/ | ||
withBearerToken(token: string): Spec; | ||
/** | ||
* basic auth | ||
@@ -207,0 +213,0 @@ * @see https://pactumjs.github.io/api/requests/withFollowRedirects.html |
@@ -291,2 +291,13 @@ const fd = require('../plugins/form.data') | ||
withBearerToken(token) { | ||
if (typeof token !== 'string') { | ||
throw new PactumRequestError('`token` is required'); | ||
} | ||
if (!this._request.headers) { | ||
this._request.headers = {}; | ||
} | ||
this._request.headers["Authorization"] = "Bearer " + token; | ||
return this; | ||
} | ||
withFollowRedirects(follow) { | ||
@@ -293,0 +304,0 @@ this._request.followRedirects = follow; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
164594
4937