mrak / stubby4node

A configurable server for mocking/stubbing external systems during development.
266 stars 62 forks source link

Support for handling all live requests? #80

Open tgabre opened 4 years ago

tgabre commented 4 years ago

I'm using a single yaml file and Stubby to handle all live requests to an api. Is there any support for Stubby to use a single file to dynamically handle all live requests, as such?

-  request:
      url: ^/.+
      method: [GET, POST]
   response:
      status: 302
      headers: 
         Location: https://liveEndpoint.com<% url[0] %>

As of right now, all requests going through Stubby are GETs despite the client app sending out GETs and POSTs.

mrak commented 4 years ago

You should be able to use a wildcard url; it is just a regex match.

tgabre commented 4 years ago

I have no problems with the urls, the regex match just fine. My problem is the request methods don't act dynamically. I list out GET and POST in the method field. My client will send GETs, which Stubby intercepts and acts in an expected manner. The client will subsequently send a POST, only for Stubby to intercept and send a GET.