stub-azure-function-context
Advanced tools
Comparing version 2.3.1 to 2.4.0
@@ -56,3 +56,3 @@ "use strict"; | ||
function createHttpRequest(data = {}) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j; | ||
return { | ||
@@ -68,9 +68,10 @@ headers: Object.entries(data.headers || {}).reduce((headers, [key, value]) => { | ||
}, | ||
body: (_b = (_a = data.body) !== null && _a !== void 0 ? _a : safeJSONParse(data.rawBody)) !== null && _b !== void 0 ? _b : data.rawBody, | ||
method: (_c = data.method) !== null && _c !== void 0 ? _c : 'GET', | ||
params: (_d = data.params) !== null && _d !== void 0 ? _d : {}, | ||
query: (_e = data.query) !== null && _e !== void 0 ? _e : {}, | ||
rawBody: (_f = data.rawBody) !== null && _f !== void 0 ? _f : JSON.stringify(data.body), | ||
url: (_g = data.url) !== null && _g !== void 0 ? _g : 'https://example.com/', | ||
user: (_h = data.user) !== null && _h !== void 0 ? _h : null, | ||
bufferBody: ((_a = data.bufferBody) !== null && _a !== void 0 ? _a : data.rawBody) ? Buffer.from(data.rawBody) : Buffer.from(data.body ? JSON.stringify(data.body) : []), | ||
body: (_c = (_b = data.body) !== null && _b !== void 0 ? _b : safeJSONParse(data.rawBody)) !== null && _c !== void 0 ? _c : data.rawBody, | ||
method: (_d = data.method) !== null && _d !== void 0 ? _d : 'GET', | ||
params: (_e = data.params) !== null && _e !== void 0 ? _e : {}, | ||
query: (_f = data.query) !== null && _f !== void 0 ? _f : {}, | ||
rawBody: (_g = data.rawBody) !== null && _g !== void 0 ? _g : JSON.stringify(data.body), | ||
url: (_h = data.url) !== null && _h !== void 0 ? _h : 'https://example.com/', | ||
user: (_j = data.user) !== null && _j !== void 0 ? _j : null, | ||
parseFormBody() { | ||
@@ -77,0 +78,0 @@ if (!this.headers['content-type']) { |
{ | ||
"name": "stub-azure-function-context", | ||
"version": "2.3.1", | ||
"version": "2.4.0", | ||
"description": "Provides an object similar to Function Runtime's context for use in unit testing", | ||
@@ -64,3 +64,3 @@ "main": "dist/index.js", | ||
"nyc": "^15.1.0", | ||
"sinon": "^15.0.1", | ||
"sinon": "^16.0.0", | ||
"sinon-chai": "^3.7.0", | ||
@@ -67,0 +67,0 @@ "ts-node": "^10.9.1", |
# stub-azure-function-context | ||
[![Build Status](https://github.com/willmorgan/stub-azure-function-context/actions/workflows/nodejs.yml/badge.svg)](https://github.com/willmorgan/stub-azure-function-context/actions/workflows/nodejs.yml) | ||
[![Build Status](https://github.com/willmorgan/stub-azure-function-context/actions/workflows/release.yml/badge.svg)](https://github.com/willmorgan/stub-azure-function-context/actions/workflows/release.yml) | ||
@@ -5,0 +5,0 @@ Aims to implement the context object as described on the [Azure Functions JavaScript Developer Guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node#context-object) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
56123
641