Giter VIP home page Giter VIP logo

stubmatic's People

Contributors

amitguptagwl avatar bhavayanand9 avatar dependabot[bot] avatar jawn avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

stubmatic's Issues

direct debug HTTP roundtrip without any configuration or mocks

Currently stubmatic can be used to debug a HTTP request without setting up any workspace;

$ stubmatic -v --debug [-p XXXX]

It also supports proxy a request to other server.

-  request:
      url: /someurl/.*

   response:
      proxy: http://google.com:8003

The combined feature can be used to debug HTTP response;

$ stubmatic -v --debug [-p XXXX] --to http://google.com

Requirement : When a user runs stubmatic with argument to, it should ignore any request response mapping. and should work as a proxy. if the --debug parameter is passed then it should log everything to the console or output stream.

Different HTTP response for each request

Currently, a user can create the mapping to serve the response from random files or in a round-robin fashion. (wiki)

-  request:
      url: /stubs/employee/([0-9]+)

   response:
      strategy: random
      files: ["<% url.1 %>.xml","file2.xml","file3.xml"]

Or

-  request:
      url: /stubs/employee/([0-9]+)

   response:
      strategy: random
      files: ["<% url.1 %>.xml","file2.xml",{"name":"file3.xml","status":500}]

But what if a user wants the same behavior but without any response in the body? He can create an empty file and do a hack like this;

-  request:
      url: /stubs/employee/([0-9]+)

   response:
      strategy: random
      files: [{"name":"empty","status":500}, {"name":"empty","status":503}]

We're looking for some meaningful mapping

-  request:
      url: /stubs/employee/([0-9]+)

   response:
      strategy: random
      status: [ 500, 503 ]

Node 10 breaks stubmatic dynamic features

After switching node version from 8.9.4 to 10.13.0, dynamic features (evaluating keys at the response) is not working well. What I got in the response is just the evaluated key, not the entire response.

After debugging, I found the problem in lib/expressions/engine.js line 30
expressions[i]=new Expression(match[match.length-2], match[1]);

The problem is that match.length is different with node.js 10 and node.js 8.
So for start index you get a string and not a number.
Please see attached screenshots.
node8
node10

Json body Validation

I want to create a rest API and I want to validate the request and respond with proper error message If a specific field is not available or empty or invalid .

Can I do this using Stubmatic ?

Error Handling ??

Hi,

Can I perform error handling on the validation errors, aroused due to the wrong input of post data?

For example I created an endpoint in response.yaml which accepts XML and returns a set of XML file already saved in project path.Still, it was fine was and working as expected, but I wanted to perform validations also on XML post body provided and throw error respectively can I do such things stubmatic.

Regards.

Stubmatic 6

We're currently working on new features in Stubmatic. Your suggestion would help us to lead in the correct direction.

Targeted major features

  1. Single handler. We were previously using 3 different handlers to feed information to the dynamic response: <% url.1 %>, [[dumpspath:file1,file2]], {{ TODAY }}. Now we'll be using a single handler: {{ include("file1", "file2") }}. [ Done ]
  2. Record and Play. Now you'll be able to record the response of different servers and serve the same response without connecting to that server again. It also records the request-response mapping to reduce your work. [ Done ]
  3. Dashboard. We want to create a GUI where you can see all the mappings and recordings. So it'll be helpful to manage all the mappings, reset counters, or add the mappings on the fly. We're also targetting to test a mapping from the dashboard. This feature will surely take long time so we'll be launching partial features with the release of stubmatic 6. And will keep adding more features. [Not started yet]
  4. Request payload matching. Currently only regex support is provided to match and capture request payload. Sometimes regex become difficult to understand. Hence, we're working on xpath, and jsonpath in case of XML, JSON, YAML inputs. [In Progress]

Error when calling from java web service client

I have create a mock that work fine when its called from SoapUI, but fail when its called from a generated java web service client. I thing that the body is not recognizing propertly, because in the log, resolved is null.

Simplifying the use of regular expressions

Why

In current version of Stubmatic, we use regular expressions to match & catch HTTP request. Writing regular expression can be an easy task for a developer, but reading and understanding it later is complex.

What

To solve this we're planning to use named regular expressions. E.g.

\authorize\(admin|staff|user)

can be replaced with

\authorize\:role:

How

  1. Create a set of regular expressions a project may need. Save them in a file
role : (admin|staff|user)
  1. Load this file when the Stubmatic starts before loading the mappings
  2. Replace each named regular expression with actual regular expression in mapping loaded into the memory.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.