Skip to content

Commit

Permalink
Merge branch 'inject-branch'
Browse files Browse the repository at this point in the history
* inject-branch: (27 commits)
  updating netbeans to 8.1
  updating documentation saving new copy of collection backups
  updating documentation saving new copy of collection backups
  linting
  display INJ for match based on injection
  adding second response to injector test backup
  js beautify doesn't minimize so handling separately
  working on response injection
  added catch all for posts fixed problem when path was set empty for match
  saved mountebank-UI configuration
  documentation 3
  documentation 2
  documentation
  added body formatting back to match body
  add verb to imposter selector buttons
  empty body for match and response
  css formatting for injection areas 2
  css formatting for injection areas
  adding help adding js formatting
  formatting
  ...
  • Loading branch information
d committed Dec 2, 2015
2 parents 06a3558 + a67f634 commit 2562c56
Show file tree
Hide file tree
Showing 27 changed files with 2,121 additions and 417 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ bower_components
/public_html/mountebank-UI/assets/js/
/reports/
/mb.pid
/mb.log
/mb*.log
/build/
11 changes: 10 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ module.exports = function (grunt) {
},
dist: {
// the files to concatenate
src: ["public_html/mountebank-UI/assets/js/jquery/jquery.min.js",
src: [
"public_html/mountebank-UI/assets/js/jquery/jquery.min.js",
"public_html/mountebank-UI/assets/js/jquery-ui/jquery-ui.min.js",
"public_html/mountebank-UI/assets/js/bootstrap/dist/js/bootstrap.min.js",
"public_html/mountebank-UI/assets/js/angular/angular.js",
Expand All @@ -40,6 +41,7 @@ module.exports = function (grunt) {
"public_html/mountebank-UI/sections/import/import.ctl.js",
"public_html/mountebank-UI/sections/home/sorter.ctl.js",
"public_html/mountebank-UI/sections/json/json.ctl.js",
"public_html/mountebank-UI/sections/help/main_help.ctl.js",
"public_html/mountebank-UI/sections/help/help.ctl.js",
"public_html/mountebank-UI/components/headers/headers.drct.js"],
// the location of the resulting JS file
Expand Down Expand Up @@ -122,6 +124,13 @@ module.exports = function (grunt) {
dest: 'build/',
flatten: true

},
js_beautify:{
expand: true,
cwd: 'public_html/mountebank-UI/assets/js/js-beautify/js/lib',
src: "beautify.js",
dest: 'build/public_html/mountebank-UI/assets/js/'

}
},
karma: {
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ is a given response/match pair. New imposters can be added or deleted
on this page as well. Additionally, imposters can be sorted, to allow for
handling short-circuit matching logic.

### Support for Injection
Injection of predicates and responses is supported in Mountebank UI. To use
it, beware that it is either Injection OR Standard, and using one will wipe
out any work for the other. Select the work areas via the toggle checkbox.
For more see the [Mountebank Injection Documentation](href="http://www.mbtest.org/docs/api/injection").

> ### Notes
> * Http protocol only
> * For any element in Response or Match, if left blank it will not be
Expand All @@ -30,7 +36,7 @@ handling short-circuit matching logic.
> * Method is not optional
> * The match logic is each group (body, query parameters, headers)
> are AND'd together. Complex logic using OR is not currently
> available
> available. You can use Injection instead.

## Collection Maintenance Page
Expand Down
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"angular-messages": "~1.4.7",
"angular-mocks": "~1.4.7",
"angular-ui-sortable": "~0.13.4",
"jquery-ui": "~1.11.4"
"jquery-ui": "~1.11.4",
"js-beautify": "~1.5.10"
}
}
36 changes: 36 additions & 0 deletions docs/handlebars/htest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@



function processRequest(request, logger) {


var handlebars = require('handlebars');
var JSON = require("JSON3")
var sentIn = JSON.stringify(request,null);
// logger.info('sentIn');

var source = '{"book": "{{title}}","publication": {{year}}, "ISBN": "{{random}}" }';
var ran = Math.floor(1053 + Math.random() * 124 + .5) + "-ADGJK-" + Math.floor(1057 + Math.random() * 124 + .5)

var data = {
"title": "Anne of Green Gables",
"year": 1985,
"random": ran
};

var template = handlebars.compile(source);
var textJSON = template(data);
//var jj = JSON.parse(html)
// console.log(html);


return {
headers: {
'Content-Type': 'application/json'
},
body: textJSON,
statusCode: 200
};
}
var t = processRequest();
console.log(JSON.stringify(t,null,2))
Loading

0 comments on commit 2562c56

Please sign in to comment.