simple-json-replay-server
Advanced tools
Comparing version 0.0.11 to 0.0.12
@@ -0,0 +0,0 @@ { |
// Place your settings in this file to overwrite default and user settings. | ||
{ | ||
} |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ { |
{ | ||
"name": "simple-json-replay-server", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "A simple json replay server which can be used for standalone frontend web application (angular especially) when development. Simply put the url & parameters & response json data, then hit the url in browser or from your web application, whenever it matches the url and parameters, it will return the best match json data.", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
@@ -127,2 +127,3 @@ # Simple JSON Replay Server ❤️ [![Build Status](https://travis-ci.org/realdah/simple-json-replay-server.svg?branch=master)](https://travis-ci.org/realdah/simple-json-replay-server) [![npm version](https://badge.fury.io/js/simple-json-replay-server.svg)](https://badge.fury.io/js/simple-json-replay-server) [![Node version](https://img.shields.io/node/v/simple-json-replay-server.svg?style=flat)](http://nodejs.org/download/) | ||
data | a json object map | Yes | you can define the expected json response. | ||
html | a string | Yes | When you define **html** as response, please note that you should not define **data**, if both **data** & **html** are defined, it will consider only **data**. | ||
@@ -248,2 +249,3 @@ | ||
0.0.10 | Include **body** mapping for **json body** (application/json) & **form-urlencoded** (application/x-www-form-urlencoded) | ||
0.0.11 | support filtering by **headers** value. | ||
0.0.11 | support filtering by **headers** value. | ||
0.0.12 | support new response type as **html** |
@@ -67,6 +67,13 @@ var express = require('express'); | ||
function response(res, mockDataConfig) { | ||
res.header("Content-Type", "application/json") | ||
.status(mockDataConfig.response.status) | ||
.json(mockDataConfig.response.data); | ||
if(mockDataConfig.response.data) { //json data | ||
res.header("Content-Type", "application/json") | ||
.status(mockDataConfig.response.status) | ||
.json(mockDataConfig.response.data); | ||
} else { //assume it is html data | ||
res.header("Content-Type", "text/html") | ||
.status(mockDataConfig.response.status) | ||
.send(mockDataConfig.response.html); | ||
} | ||
} | ||
@@ -0,0 +0,0 @@ var _ = require('underscore'); |
@@ -0,0 +0,0 @@ var glob = require("glob"); //load many files and filtering with some rules at one shot |
@@ -0,0 +0,0 @@ var _ = require('underscore'); |
@@ -0,0 +0,0 @@ var chokidar = require('chokidar'); |
@@ -0,0 +0,0 @@ var assert = require('assert'); |
@@ -0,0 +0,0 @@ var assert = require('assert'); |
@@ -0,0 +0,0 @@ var assert = require('assert'); |
@@ -0,0 +0,0 @@ var assert = require('assert'); |
@@ -0,0 +0,0 @@ var assert = require('assert'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
43434
22
802
249