mockttp
Advanced tools
Comparing version 0.15.0 to 0.15.1
@@ -144,2 +144,3 @@ "use strict"; | ||
else { | ||
// If error is not set, result must be | ||
resolve(result); | ||
@@ -146,0 +147,0 @@ } |
@@ -51,7 +51,7 @@ /** | ||
queryObject: { | ||
[key: string]: string | number; | ||
[key: string]: string | number | (string | number)[]; | ||
}; | ||
readonly type: 'query'; | ||
constructor(queryObject: { | ||
[key: string]: string | number; | ||
[key: string]: string | number | (string | number)[]; | ||
}); | ||
@@ -58,0 +58,0 @@ buildMatcher(): ((request: OngoingRequest) => boolean) & { |
@@ -91,3 +91,3 @@ "use strict"; | ||
buildMatcher() { | ||
const expectedQuery = _.mapValues(this.queryObject, (v) => v.toString()); | ||
const expectedQuery = _.mapValues(this.queryObject, (v) => Array.isArray(v) ? v.map(av => av.toString()) : v.toString()); | ||
return _.assign((request) => { | ||
@@ -94,0 +94,0 @@ let { query } = url.parse(request.url, true); |
@@ -48,3 +48,3 @@ /** | ||
withQuery(query: { | ||
[key: string]: string | number; | ||
[key: string]: string | number | (string | number)[]; | ||
}): MockRuleBuilder; | ||
@@ -51,0 +51,0 @@ /** |
@@ -5,2 +5,2 @@ import * as net from 'net'; | ||
export declare const isLocalIPv6Available: boolean; | ||
export declare function isLocalPortActive(interfaceIp: '::1' | '127.0.0.1', port: number): Promise<{}>; | ||
export declare function isLocalPortActive(interfaceIp: '::1' | '127.0.0.1', port: number): Promise<unknown>; |
{ | ||
"name": "mockttp", | ||
"version": "0.15.0", | ||
"version": "0.15.1", | ||
"description": "Mock HTTP server for testing HTTP clients and stubbing webservices", | ||
@@ -98,3 +98,3 @@ "main": "dist/main.js", | ||
"typedoc-plugin-external-module-name": "^2.0.0", | ||
"typescript": "^3.4.3", | ||
"typescript": "3.5.3", | ||
"webpack": "^3.7.1", | ||
@@ -101,0 +101,0 @@ "ws": "^6.1.2" |
@@ -88,2 +88,3 @@ /** | ||
requestId: string; | ||
// Exactly one of these is always set: | ||
error?: Error; | ||
@@ -195,3 +196,3 @@ result?: CallbackHandlerResult; | ||
const rpcCallback = (request: CompletedRequest) => { | ||
return new Promise((resolve, reject) => { | ||
return new Promise<CallbackHandlerResult>((resolve, reject) => { | ||
let requestId = uuid(); | ||
@@ -202,3 +203,4 @@ outstandingRequests[requestId] = (error?: Error, result?: CallbackHandlerResult) => { | ||
} else { | ||
resolve(result); | ||
// If error is not set, result must be | ||
resolve(result as CallbackHandlerResult); | ||
} | ||
@@ -205,0 +207,0 @@ delete outstandingRequests[requestId]; |
@@ -109,3 +109,3 @@ /** | ||
constructor( | ||
public queryObject: { [key: string]: string | number }, | ||
public queryObject: { [key: string]: string | number | (string | number)[] }, | ||
) { | ||
@@ -116,3 +116,5 @@ super(); | ||
buildMatcher() { | ||
const expectedQuery = _.mapValues(this.queryObject, (v) => v.toString()); | ||
const expectedQuery = _.mapValues(this.queryObject, (v) => | ||
Array.isArray(v) ? v.map(av => av.toString()) : v.toString() | ||
); | ||
@@ -119,0 +121,0 @@ return _.assign( |
@@ -120,3 +120,3 @@ /** | ||
*/ | ||
withQuery(query: { [key: string]: string | number }): MockRuleBuilder { | ||
withQuery(query: { [key: string]: string | number | (string | number)[] }): MockRuleBuilder { | ||
this.matchers.push(new QueryMatcherData(query)); | ||
@@ -123,0 +123,0 @@ return this; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3553272
235
9797