-
Notifications
You must be signed in to change notification settings - Fork 46
Variable response from request data #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Adding passing test for returning responses in subfolders
really using github issues for that :)
Fixing default cors settings
Support the use of // in http:// and URI's in JSON
adding correct headers in CORS reponses, plus passing test
Support Query Params
To make sure the codebase gets a little more consitency I setup jshint and made some basic style fixes
inside new RegEx a . needs to be \\. or it will match like a . in / /
Jshint code style
this allows logging the real filename which matched, instead of constructing it, which make logging the name for query params work. FIXES #15
inject filename in the httpObject
before the error was just hidden now it is logged when he sanatization of the content fails, this is especially important for JSON since it needs to be parseable to be returned by canned otherwise just false is returned RESOLVES #4
Log an error if content sanatization fails
Needed to wrap commands in code tags
initially the plan obviously was to use id as the special name, but now canned is using any as the keyword. So naming the files in example ```id.get.json``` is just wrong, to make them available via ```curl localhost:3000/comment/1``` they need to be named ```any.get.json``` and accordingly ```any.put.json```. This causes confusion as seen in #20
naming files id is wrong should be any
`contentType` file header
Aarrrgggh! Forgot those pesky quotes.
Fixed contentType header examples
Add support for empty files, returns status code 204 by default
Thanks to jkjustjoshing for that, awesome!
use either the 0.10 or 0.11 branch but use the latest versions for both
This is the first step to support windows since this will make moving the query to the file possible. You can now create multiple files with a number attached to the end of the name. Currently the first file, according to file listing, will be picked, this is WIP so and it should be a random pick.
this is the first step towards supporting get parameters in the file header. Files will match even when extended with another . seperated part in the name like ``` _action.verb.type.1 ``` work towards issue #19
Thanks for that, from first looks its good! It's definitely functionality I feel is important and I've been working on something similar but didn't get to finish so thanks soo much for the PR. I will look over this asap |
@HungryDavid do you mind rebasing so the history stays clean? |
Great, glad it's useful. Sure, I'll rebase as soon as I get a chance - knew there was something I forgot! |
Adds the ability to switch response payload based on request data. This can be either payload or header data
README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind fixing the formatting? The other parts of the readme are formatted with 80chars per line, I can do it as well post merge but want to keep the Readme "clean"
This looks good to me. Sorry to be a little annoying about small things like semicolon and such, I can change those after merge as well. |
Not a problem at all about code style bits. I'll fix them up, always good to maintain a consistent style. You're right about the status/body test, that is something I've overlooked. I'll take a look at that as soon as I can - hopefully tomorrow. |
Test combining status code and repsonse body options. Update README to document how to combine them. Update contributors list
I've added the test combining the status and response options. It doesn't currently support varying status code per response - that would need a bit of a rewrite of the extractOptions method. I'm happy to take a look at this, but I won't have time for a little bit now. Thanks for writing canned, it's a great tool. I've been searching for a suitable mock server for a while and it's definitely the best I've come across. |
Variable response from request data
This looks good and very valuable to me! Thanks for the contribution. I'm always very excited to hear people are using canned. Would you be interested to add yourself to the Use cases page I just created? |
Glad to be able to help :) Yeah, sure. I’ll add something to the use cases in the next couple of days. Thanks. — On Wed, Nov 19, 2014 at 6:53 PM, Philipp Fehre notifications@github.com
|
Hi,
I’ve added the ability to get variable responses from an endpoint, based on request data. This is something I personally need from canned. I usually end up needing this when working with anything more than a simple api.
Please feel free to close if it doesn’t fit with the goals of the project.
Thanks.