Code Monkey home page Code Monkey logo

azagniotov / stubby4j Goto Github PK

View Code? Open in Web Editor NEW
348.0 22.0 103.0 26.81 MB

HTTP/1.1, HTTP/2 and WebSockets stub server for stubbing distributed web services in Docker and non-containerized environments for integration and contract testing

Home Page: https://www.stubby4j.com

License: Apache License 2.0

Java 97.84% HTML 0.24% CSS 0.33% JavaScript 1.09% Dockerfile 0.23% Shell 0.28%
stub-server mock-server http-stub api-testing record-and-replay api-mocking integration-testing consumer-driven-contracts rest-api-test contract-testing

stubby4j's Introduction

HTTP/1.1, HTTP/2 and WebSockets stub server for stubbing distributed web services in Docker and non-containerized environments for contract testing

CircleCI build master branch DockerHub GitHubStars GitHubForks codecov Maven Central Stackoverflow stubby4j

stubb4j

It is a highly flexible and configurable tool for testing interactions of service-oriented (SoA) or/and micro-services architectures (REST, SOAP, WSDL, etc.) over HTTP/1.1, HTTP/2 and WebSockets protocols.

Full documentation

pages-build-deployment say thanks!

Full documentation hosted at https://stubby4j.com, which includes a comprehensive user guide, various HOWTOs and usage examples.

Key features

There are a number of use cases where you'd want to use WebSockets, HTTP/1.1, HTTP/2 stub server in your development/QA environment. If you are a Software Engineer/Test Engneer/QA, then it should hit close to home with you. As an example, some of these use cases are outlined below (this is by no means an exhaustive list). Use stubby4j when you want to:

  • Dockerzied. Stub out external services in a Docker based micro-service architecture (ARM64 Docker images are also available!)
  • Support for TLS protocol versions 1.0, 1.1, 1.2 and 1.3
  • Support for HTTP/2 over TCP (h2c) and HTTP/2 over TLS (h2) on TLS v1.2 or newer using ALPN extension
  • Verify that your code makes HTTP/1.1 or HTTP/2 (over TLS) requests with all the required parameters and/or headers
  • Support for WebSocket protocol over HTTP/1.1 (with TLS and without) for request verification, response stubbing, server push, and more
  • Fault injection, where after X good responses on the same URI you get a bad one
  • Dynamic flows. Multiple stubbed responses on the same stubbed URI to test multiple application flows
  • Request proxying. Ability to configure a proxy/intercept where requests are proxied to another service
  • Record & Replay. The HTTP response recorded on the first call, having the subsequent calls play back the recorded HTTP response, without actually connecting to the external server
  • Regex support for dynamic matching on URI, query params, headers, POST payload (ie:. mod_rewrite in Apache)
  • Dynamic token replacement in stubbed response, by leveraging regex capturing groups as token values during HTTP request verification
  • Serve binary files as stubbed response content (images, PDFs. etc.)
  • Support for delayed responses for performance and stability testing
  • Support for HTTP 30x redirects verification
  • Support for different types of HTTP Authorizations: Basic, Bearer Token & others
  • Embed stubby4j to create a web service SANDBOX for your integration test suite
  • Verify that your code correctly handles HTTP response error codes

Full documentation hosted at https://stubby4j.com, which includes a comprehensive user guide, various HOWTOs and usage examples.

Minimal system requirements

Running stubby4j as a standalone JAR

See https://stubby4j.com/#minimal-system-requirements for more information.

Running stubby4j as a pre-built Docker container

See https://stubby4j.com/#running-in-docker for more information.

Docker Compose

See https://stubby4j.com/#docker-compose for more information.

Full documentation hosted at https://stubby4j.com, which includes a comprehensive user guide, various HOWTOs and usage examples.

stubby4j's People

Contributors

alenkacz avatar angusng avatar avinashk avatar azagniotov avatar boxen-jin avatar bryant1410 avatar dzmitryh avatar goughy000 avatar lenarbad avatar moleksyuk avatar mrak avatar noodlecookie avatar oleksandrberezianskyi 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stubby4j's Issues

Json in postBody for request object

Hi,

Could you add example to YAML configuration sample how to define json in post body?(if it's possible)
Example

  • request:
    method: POST
    url: /some/uri?param=true&anotherParam=false
    headers:
    content-type: application/json
    postBody: {
    "attr1":"value1",
    "attr2":"value2"
    }

PUT AND DELETE METHOD SUPPORT in SubbyClient

Hi Sir,
we are creating stub using sc.startJetty(25030,defaultAdminPort, appHost, url.getFile());
and stubbs created sucessfully

Now i am tring to access all stubs using StubbyClient.java and its working fine in case of GET and POST method.

But during PUT and DELETE method facing following exception

"HTTP method PUT not supported when contacting stubby4j"

Following are the exception logs
2015-04-21T09:17:45.23+0000 [App/0] OUT stubbyRequestBody12b1b230-484d-4a2c-9873-1c1332a77a3d
2015-04-21T09:17:45.26+0000 [App/0] ERR 2015-04-21 09:17:45.262:INFO::http-nio-63379-exec-2: Logging initialized @61311ms
2015-04-21T09:17:45.26+0000 [App/0] OUT exception during make request
2015-04-21T09:17:45.27+0000 [App/0] ERR by.stub.exception.Stubby4JException: HTTP method 'PUT' not supported when contacting stubby4j

FOR DELETE
Connected, tailing logs for app msgdirmgmt-test10 in org cfc-his / space alpha as admin...

2015-04-21T07:54:39.72+0000 [App/0] OUT stubbyRequestBody12b1b230-484d-4a2c-9873-1c1332a77a3d
2015-04-21T07:54:39.73+0000 [App/0] OUT exception during make request
2015-04-21T07:54:39.74+0000 [App/0] ERR by.stub.exception.Stubby4JException: HTTP method 'DELETE' not supported when contacting stubby4j

Record&Replay: regex being send in place of the actual query or header value

When a response is recorded with Record&Replay, the regex values in the header and query fields are used to create the request sent to the server specified in the response.body field. The actual value should be used instead.
Example:
a request such as :
http://myserver/Search?queryvalue=ciao

intercepted by the following yaml request:

  • request:
    method: GET
    url: /search
    query:
    queryvalue: "([a-zA-Z]+)"
    response:
    status: 200
    body: http://127.0.0.1:8888

will create an http request for 127.0.0.1:8888 that will contain a queryvalye=([a-zA-Z]+) rather than a queryvalue=ciao.

not able to see request and response body after enableing --debul logs even

I used ConsoleUtils.enableDebug(true) to get request and response bodies on console, but not able to get .
Kindly look into it, in our use case requirement in which when any request gets failed at stubby's end then we want to see request and response body for debugging , but currently it is not dumping the same

Live refresh in response sequence only for first response

The live refresh of external files in a sequence of responses only works for the file in first entry.
Take this as an example:

response:
    -   status: 200
        headers:
            content-type: application/xml
        file: ../responses/first.xml

    -   status: 200
        headers:
            content-type: application/xml
        file: ../responses/second.xml

If "first.xml" is subject to changes the live refresh is performed, if however "second.xml" changes no live refresh is done. If second.xml is included in another response (as first or only entry) then it will change, too.

Parameters order should not matter for stubby

Right now URLs should match exactly to trigger stubby response. But URL

http://localhost:8882/example?param1=val1&param2=val2

is the same (with very rare exceptions) as URL

http://localhost:8882/example?param2=val2&param1=val1

It would be nice to introduce 'parameters' field to URL field, e.g:

- request:
   method: GET
   url: http://localhost:8882/example
    parameters: 
     param1: val1
     param2: val2
  response:
   status: 200

Capture post body using regex

Hi guys, just a quick question. I am having trouble capturing some values from the request body. Is this supported? If so, what is the required form of the request regex and the tokens in the response?
The request passes the match when the regex is in this form
body: BillingSurname: "(.)"
BillingFirstnames: "(.
)"
BillingAddress1: "(.)"
BillingCity: "(.
)"
BillingPostCode: "(.)"
BillingCountry: "(.
)"
DeliverySurname: "(.*)"

I cant capture these using body.BillingSurname.1 // post.BillingSurname.1 // post.1
I have tried writing a full regex for the request body, but this does not work either
eg. &BillingFirstnames="(.)"&BillingAddress1="(.)"

Thank you

XML in post not working

Text above is single line

response:
headers:
Content-Type: application/xml
location: http://localhost:8882/api/v1/types/pid
status: 201
body: >
<idex:type id="https://idex.cloud.bbc.co.uk/api/v1/types/pid">
idex:authorityPIPS/idex:authority
idex:namepid/idex:name
idex:startsWithpid:///idex:startsWith
/idex:type

When I try to run with above fixture it says as follows:

404 No data found for POST request at URI /api/v1/types With post data: <idex:type xmlns:idex="http://idex.bbc.co.uk/v1">idex:authorityPIPS/idex:authorityidex:namepid/idex:nameidex:startsWithpid:///idex:startsWith/idex:type With headers: {host=localhost:8882, accept=text/plain, application/json, application/+json, */, content-length=220, content-type=application/xml, connection=keep-alive, user-agent=Java/1.6.0_35}

Can you please suggest?
I have tried regex as well but still not working, only regex works is (.*).
I have also tried putting the xml in file, but still does not work.

StubbyClient shall allow to specify binding Address when staring Stubby programatically

First, thanks for all the great work on your Stubby4j, it looks very promising and we are currently looking into using it for our functional test.

Unfortunately, it seems that the Bind Address Jetty is started can only be configured from the command line interface by passing --location switch.... It seems like there isn't any equivalent in the programmatic API (startJetty(...)).

To workaround our issue, we did add the following line in the params HashMap inside StubbyClient.startJetty method :

params.put(CommandLineInterpreter.OPTION_ADDRESS,"0.0.0.0");

While this works, it would be great support this OPTION_ADDRESS as a parameter.

Hopefully my explanation are clear enough :)

Thanks a bunch
/Antoine Lemieux

query params are not recognized any more

-  request:
      method: POST
      url: test-url
      query:
         param: 1
      headers:
         content-type: application/json
      file: body.txt
   response:
      status: 200
      headers:
         content-type: application/json
      body: '"true"'

will result in next stub (result of toString() of stubHttpLifecycles):

[StubHttpLifecycle{request=StubRequest{url='test-url', method='POST', post='null', file='{
  "field" : "val"
}', headers={content-type=application/json}}, response=StubResponse{status='200', body='"true"', latency='null', headers={content-type=application/json}, params={}}}]

as you can see there is nothing that corresponds to param: 1

UPDATE: ok, now I see that you have removed 'query' field from text of description here https://github.com/azagniotov/stubby4j/blob/master/docs/YAML.md but it is still in examples. Please fix examples.

Start Jetty Server without YAML configuration file

For our integration tests, we setup stub responses (using the POST endpoint) before each scenario and then refresh the stubs afterwards.
However, I still need to create a dummy YAML configuration file to boot up the Jetty server.

It would be nice if the YAML file is optional parameter to startJetty to avoid creating a dummy file.

Can you provide a skinny jar?

Our project depends on other versions of jetty (and other jars) which are not compatible with the ones being bundled in the fat jar.

Could you provide a skinny jar which defines a list of dependencies we need to include ourselves? Preferably through a POM file.

It would also be nice if this project was in maven central.

Random responses

I am looking to provide a response that returns a randomized value. eg.

response:
headers:
content-Type: application/json
body: >
{"data":[{"profileid":(someRandomNumber),"username":(ARandomStringOfLengthN)]}

Is there anyway do such a thing in the YAML?

If not could you consider implementing?

Kind regards

Negative JSON Regex

When I try and specify negative look ahead regex's within my JSON post I never get the expected response. e.g.

`- request:
method: [POST]
headers:
content-type: application/json
url: ^/test
post: '{"title":"(.)","firstName":"(^(?!john$).)"}'
response:

  • status: 200`

returns a 404 on any call. Although I have tested the above regex + several other variations and no luck. Is there something glaring obvious I am missing?

POST request used:

curl -v -X POST -H "content-type: application/json" -d '{"title":"Ms","firstName":"Jeff"}' http://192.168.10.101:8882/test

Expose java admin api

I wish I could interact with admin through java interface instead of dealing with http calls.
I would be happy to send a PR if this is useful.

Dynamic token replacement not working on body post with JSON content type

the regexp does not match the stub if Content-Type is application/json ( probably the same with xml )

yaml :

-  request:
      method: [POST]
      url: /client
      post: ".*\\{\"code\":\"(.*)\",\"name.*"
   response:
      status: 201
      header:
          Content-Type: application/json
      body: >
           {"id":"<% post.1 %>","link":"http://mysite.com/client/<% post.1 %>"}

body of the response when submitting a POST request with Content-Type=application/json :

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 404 </title>
</head>
<body>
<h2>HTTP ERROR: 404</h2>
<p>Problem accessing /client. Reason:
<pre>    (404) Nothing found for POST request at URI /client
    With post data: {"code":"4f3117dc68","name":"Test site"}
    With headers: {accept=*/*, cache-control=no-cache, connection=keep-alive, user-agent=Apache-HttpClient/4.3.6 (java 1.5), host=localhost:8882, accept-encoding=gzip,deflate, content-length=40, content-type=application/json}</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
</body>
</html>

result submitting a POST request without Content-type :

{"id":"4f3117dc68","link":"http://mysite.com/client/4f3117dc68"}

This is probably due to 69ede0b#diff-15eaafe111640649eb49b61698b0cb2dR251

Does it support regular expression in Json post request?

I would like to match some regular expressions in the json post request. Is it possible?

-   request:
        url: ^/MyServer/services/rest/doclist/
        method: POST
        headers:
                content-type: application/json
        post: '{"userId":"19","requestId":"(.*)","transactionDate":"(.*)","transactionTime":"(.*)"}'

OAuth Support for Stubby4j

Hi,
Would you be able to add oAuth support for Header verification? or may be you could provide us code pointers so that we might change it and sent it to you for review.
-Nitin

Unexpected behaviour constructing requests with query parameters values containing white spaces

I'm not sure if its a bug or limitation of the lib. Maybe a future enhancement.
I have a request with a query param who value contains a white space.
I followed example bellow in README but it does not work:

  • The following will match either of these:
    • /with/parameters?search=search+terms&filter=month
    • /with/parameters?filter=month&search=search+terms
-  request:
      url: ^/with/parameters$
      query:
         search: search terms
         filter: month

My query param was

-  request:
     method: GET
     url: ^/test$
     query:
       term: "boo and foo"

And in jUnit test

 String request = "http://localhost:8882/test?term=boo and foo"

which is encoded and returns not found

404 [/test?term=boo+and+foo] Not Found 

So i changed de yml query param to "boo+and+foo" in order to match, but i'm still getting 404.

[35mLoaded: [GET] ^/test$?term=boo+and+foo]

404 [/test?term=boo+and+foo] Not Found 

The solution i found was encoding the '+' char in yml file:

query:
  term: "boo%2Band%2Bfoo"

And change my test to:

String request = "http://localhost:8882/test?term=boo+and+foo"

in order to encode "+" char to "%2B" and them match.

I think that is caused by regex processing, so i tried another test, escaping '+' symbol in yml file

query:
  term: "boo\\+and\\+foo"

In this way, i can write request strings in java without any encoding troubles as folowing:

String request = "http://localhost:8882/test?term=boo and foo"
[35mLoaded: [GET] ^/test$?term=boo\+and\+foo]

200 [/test?term=boo+and+foo] OK 

As i said, i'm not sure if it can be considered as a bug or lib's limitation. Maybe a future enhancement, or just an update in docs about this specific case. Another chars encoding does not have this problem.
I hope that it helps to improve this awesome lib. Thanks!

Logging in Stubby4j

Is there a way we can increase the log level in Stubby4j? As of now we see very little information in stubby4j logs, can we some how increase the logging level in Stubby4j. Our intend is to see in the logs the request body which is getting posted on Stubby4j URL and any exception that is occurring in stubby4j.

Feature Requested: Dynamic override of canned response

We use stubby to generate a canned response of a web service. At times, I would like to simulate an error response from the web service.

For example: the URL http://localhost:xxxx/response-to/name/Kevin

Canned Response: 200 OK - Hello Kevin

At times I want the same URL to return: 200 OK - Get Lost!

It would be great to provide a dynamic override/reconfiguration capability. The overridden response could be specified using text or using a file reference.

Use dynamically generated identifier in the response

Use regex matching groups to determine which back-references are available for insertion into the response body.

This would match things like /root/resource_name with resource_name as the captured backreference $1:

-  request:
      url: /^\/root\/([a-zA-Z_]+)$/
   response:
      body: You've just hit the <% $1 %> application route!

As for the response body, you could use .erb syntax, like fakerest, to insert backreferences

This would require modifying the overwritten class equals function for StubRequest, and the function (forget the name) that uses StubResponse.body to set the response and make it use erb interpolation using the backreferences captured from the url.

For more context: #12

unable to read post data when run with `--debug`

given the endpoint:

- request:
    method: [POST]
    url: /foo
    post: "^qqq=123$"

running with --debug causes this error:

 POST [stubs]/foo: Error when extracting POST body: java.util.NoSuchElementException, returning null..

In debug mode, the raw HTTP request is parsed and dumped to stdout. Later, the code reads the request input stream to process the post body and the stream has already been drained to perform the previous dump.

The error occurs in the extractPostRequestBody method of main/java/by/stub/utils/HandlerUtils.java

StubbyClient works but no other HttpClient or Browser

With stubbyClient.startJetty only stubbyClient.doGet works. When I try to access the configured URL from Browser or using apache HttpClient or HttpConnection, the response is 404. Why the jetty server started through stubbyClient not visible to other APIs.

Include stubbed response index inside custom header to allow future updates

One of the suggested solutions: ALWAYS to include a custom header in the response back from the stub portal which include the index of the response? Such as:

X-Stubby-Resource-ID: 7

This way it is possible to modify one of the stubbed request to return a different response after the server has been started, since the ID will be known that can be used to update the response by sending PUT request to Admin portal, for example: http://localhost:8889/4

Stubby4j matching on request body does not work whenever "?" is part of request body.

We configured a request on Stubby4j. There is ? in the top header. Whenever I remove question marks from the line then request and response work correctly, whenever there is any question mark in this line 404 comes up as ? mark is hampering that request matching. Can anybody suggest how to fix this or any work around this. ? mark is mandatory part of request.

Body is not mandatory in POST requests

This is heavily used in REST web services.

In stubby 1.0.3 sending POST without body will result in

Error 400 Oh oh :( Bad request, POST body is missing

Documentation is incorrect for 1.0.3

instead of

  final ClientRequestInfo adminRequest = 
    new ClientRequestInfo(HttpMethods.POST, AdminHandler.RESOURCE_STUBDATA_NEW,
       "localhost", 8889, content);

the one should use

  final ClientRequestInfo adminRequest = 
    new ClientRequestInfo(HttpMethods.POST, "/stubdata/new", "localhost", 8889, config);

because there is no AdminHandler.RESOURCE_STUBDATA_NEW constant as of 1.0.3

string comaprision of post request

I'm facing a issue with handling response for a post request. We use stubby4j for our UI automation. We stub all the service calls. The tests fails randomly for when it comes to post calls.
The problem with the post request is, the json that comes with the request though it have same key value pair, their order is different each time.
I understand we as using string comparison for post files, instead if we could do key value pair comparison it would be great.

Error Count details

This is more of a feature request.
Currently in our application, there are places where we just make a request and we'll not act on the response. In such places we are not able to assert if such call we made. This makes our tests incomplete.
Currently we are parsing the stub log to see if it has any error, to ensure all the request made to are valid. This is not very clean, instead if we have a end point to give number of error raised, we would use that to assert if all the request are valid.

Problem with line separator in WIN/UNIX

Steps to reproduce on Windows:
1.Create file for body request (post-body-as-file.json):

{
    "name": "value",
    "param": "description"
}

2.Define request/response:

-  request:
      method: POST
      url: /some/uri
      headers:
         content-type: application/json
      file: ../data/post-body-as-file.json

   response:
      headers:
         content-type: application/json
      status: 200
      body: OK

3.Try to post configured request on UNIX.

Expected: Get success response.
Actual:

  • Windows: works perfect
  • Unix: No data found for request... etc. (No match)

Problem is related to parsing line separator in post-body-as-file.json. On Unix file reader continues using WIN line separator and post body from java code using UNIX line separator which causes mismatching in posted request and configured.

Question - How to use the StringUtils.RemoveBrackets on incoming request

I am just wondering where I would need to apply this to filter the incoming request text. I can see that it is called during the createParamMap() method in order to create the assertionRequest to be matched to a response, but I do not understand why it is not removing the square brackets from either side of my queryString.

Thanks

Quick start - setup not working

I followed the instructions for downloading the latest jar and created a yaml file exactly like the example. When I try a GET request (curl and chrome and postman) I get a 404 for the hello-world uri and 500 for status.

Request and response bodies not coming

I've used ConsoleUtils.enableDebug(true) to get request and response bodies on console, but not able to get .
Kindly look into it, in our use case requirement in which when any request gets failed at stubby's end then we want to see request and response body for debugging , but currently it is not dumping the same.

Enhancement: Allow negated list of methods for requests

The basic use case I'm looking at it that an endpoint can take a GET (and only a GET), and any other methods will produce a 405 (method not supported). I know I can emulate this by listing all of the methods that are not permitted, but it seems like it would be helpful to be able to specify "anything other than these methods". Possible forms that come to mind are:

    method: !GET          # Or some marker to negate
    method: [!GET, !POST] # List with same marker to negate
    method: ^(?!GET).+$   # Use negative-lookahead regex

Alternatively, perhaps a runtime option to render a 405 when a URL is matched, but not the method?

"gradle install" not working correctly

running gradle install creates the following jars under ~/.m2/repository/stubby4j/main/3.2.3-SNAPSHOT :

├── main-3.2.3-SNAPSHOT-javadoc.jar
├── main-3.2.3-SNAPSHOT-no-dependencies.jar
├── main-3.2.3-SNAPSHOT-sources.jar
├── main-3.2.3-SNAPSHOT.jar
├── main-3.2.3-SNAPSHOT.pom
└── maven-metadata-local.xml

is there a task that allows deploying the correct jar in the local maven repository ?

Multiple POST request for same URL

I want to configure multiple POST request for the same URL but with different body data.
But only the first configured request is working properly.
When the second configured request matches, stubby4j seems to hang up and no response is send back to client.
Is this a known problem? Is there some kind of workaround available?
Thanks,
Michael

URL parameter being lost before request mapped to response

Hi,
I seem to be losing a parameter in a request and cannot find why
Here are my samples:

YAML req/response pair:

request:
method: POST
url: /try?scriptParams=[a-zA-Z]{3}=([A-Za-z0-9]+(?:[\s-][A-Za-z0-9]+)+)
response:
status: 200
body: complete

sample request: (sent through firefox add on 'poster')

http://localhost:8882/try?scriptParams=uid=07ef-0000-&invokePCL=true&paymentType=A

there is a value for uid="..." in the request, but the stubby output is:
<- 404 [/try?scriptParams=uid&invokePCL=true&paymentType=A] Not Found

Am I going wrong somewhere? No problems like this in the past.

thanks
(and sorry for going silent on my last issue,)

1.0.3 It is not possible to start server without YAML config file specified

We configure responses right in test because it gives a great overview of preconditions and improves test readability.

Using 1.0.3 jar, if you will start server using next code:

    Stubby4JClient server = Stubby4JClientFactory.getInstance();
    server.start();

you will get next stack trace:

java.lang.IllegalArgumentException: Given YAML config filename is null!
    at org.stubby.yaml.YamlParser.<init>(YamlParser.java:38)
    at org.stubby.server.JettyOrchestratorFactory.getInstance(JettyOrchestratorFactory.java:52)
    at org.stubby.client.Stubby4JClientImpl.start(Stubby4JClientImpl.java:51)
    at org.stubby.client.Stubby4JClientImpl.start(Stubby4JClientImpl.java:41)
    at ...

Configure dynamic urls & response

There are scenarios here where certain identifiers are dynamically generated and form part of the url.
It should be possible to configure a url, such as /items/:id, and then be able to use params[:id] so that the response can be made dynamic.

regex doesn't work for multiline request body

I am capturing request in stubby4j like this

-  request:
      method: POST
      url: /someUrl
      post: ".*(amit).*"

It works fine if I use single line in request body. E.g. User name is amit gupta. But it fails if I use multiline text as

User name is amit gupta 
secondline

How can I match some part of request body?

I need to do this. Because any extra space in post body leads 404. And even this approach doesn't work

      post: >
        .*(amit).*

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.