hoverfly

Lightweight service virtualization/ API simulation / API mocking tool for developers and testers

APACHE-2.0 License

Stars
2.3K
Committers
57
hoverfly -

Published by tommysitu over 1 year ago

Massive thanks to @kapishmalik and @petkostas! Hoverfly's simulation schema has been bumped to v5.2 to support these new awesome matchers 🚀 :

  • Array matcher: supports loose matching for array values, and this will be the default matcher for multi-value query param or header in captured data.
  • Form matcher: matches request payload with URL encoded form.
  • JWT matcher: has a built-in JWT parser, and lets you match JWT with its decoded JSON form directly.

Most excitingly new schema lets you do matcher chaining to create powerful matchers, for example, you can match a JWT token's payload containing a name JSON field with the value "John Doe", and the JWT token is present in a URL encoded form.

"body": [{
    "matcher": "form",
    "value": {
        "client_assertion": [{
	    "matcher": "jwt",
	    "value": "{\"header\":{\"alg\":\"HS256\"},\"payload\":{}}",
	    "doMatch": {
                "matcher": "jsonpath",
                "value": "$.payload",
                "doMatch": {
	            "matcher": "jsonpath",
	            "value": "$.name",
	            "doMatch": {
		        "matcher": "exact",
		        "value": "John Doe"
	            }
                }
	    }
        }]
    }
}]

For more info, please check out the doc here.

v5.2 simulation also supports declaring global literals and variables for templated response. These are the constants and helper methods which you want to re-use for templating throughout a simulation.

Other changes include Go version upgrade to 1.18 and other dependency bumps (thanks @joobus )

hoverfly -

Published by tommysitu almost 2 years ago

hoverfly -

Published by tommysitu about 2 years ago

Add support for Apple silicon and ARM64 architecture support for Hoverfly Docker image.

hoverfly -

Published by tommysitu over 2 years ago

Renew default Hoverfly CA cert

hoverfly -

Published by tommysitu over 2 years ago

hoverfly -

Published by tommysitu over 2 years ago

Bug fixes including xpath library upgrade. Add templating support for transitionsState, thanks to @ns3777k

hoverfly -

Published by tommysitu about 3 years ago

go 1.16 upgrade and some dependency bumps. Minor bug fixes, mainly for the JSON matcher, also handle gzipped request body for simulate and capture a bit better.

hoverfly -

Published by tommysitu over 3 years ago

Supports remote response body file: doc (thanks to @ns3777k)

Also build Hoverfly for Linux/ARM64 as requested by the community.

hoverfly -

Published by tommysitu about 4 years ago

bug fixes

hoverfly -

Published by tommysitu over 4 years ago

Simulation schema is upgraded to v5.1 to support the following new features (a big thanks to @ns3777k):

The binary size is up a few MBs after switching to go mod since v1.2.0, so this release strip off the debugger info to squeeze it down a little bit while we come up with a plan for hoverfly to lose some weight.

hoverfly -

Published by tommysitu over 4 years ago

Hoverfly is migrated to Go 1.14 and using Go Modules to manage its dependencies.

Feature-wise, thanks to @ri-tatsu, logging to a file is now supported:

hoverfly -logs-output=file

A new matcher type xmlTemplated is added for XML loose matching with templated functions: https://github.com/SpectoLabs/hoverfly/pull/939

hoverfly -

Published by tommysitu over 4 years ago

Thanks to @ns3777k , this release fixed a few bugs related to HTTPS proxying.

hoverfly -

Published by tommysitu over 4 years ago

Bug fixes and supports templating using request header, eg. {{ Request.Header.X-Header-Id }}

hoverfly -

Published by tommysitu about 5 years ago

A universal date time templating helper is added:

{{  now "<offset>" "<format>" }}

It generates current date time with an offset in any custom format or Unix timestamp. More info can be found in the doc.

hoverfly -

Published by tommysitu about 5 years ago

Thanks to @kulaginds' PR, you can now use templating functions in the response headers.

hoverfly -

Published by tommysitu over 5 years ago

Overwrite duplicate request in capture mode

Hoverfly by default ignores repeated requests when capturing. Using the following flag, you can set Hoverfly to capture the new request-response pair by overwriting the old one.

hoverctl mode capture --overwrite-duplicate

Bug fixes and performance improvements

Thanks to @aosavitski's PR, the performance of stateful simulation has been improved.
This release also fixed the following bugs:
https://github.com/SpectoLabs/hoverfly/issues/868
https://github.com/SpectoLabs/hoverfly/issues/865

hoverfly -

Published by tommysitu over 5 years ago

CORS support

You can now enable Cross-Origin Resource Sharing (CORS) support on hoverfly. Your web application running on the browser can make requests to Hoverfly even it’s not on the same domain.

hoverfly -cors

or

hoverctl start --cors

For more information, please see the docs.

Disable duplicate request check on simulation import

Some users experience slow import for large simulation file (a few hundred MBs with lots of pairs), you can speed it up by disabling the duplicate request checking feature:

hoverfly -no-import-check

or

hoverctl start --no-import-check

Custom Hoverfly response header

A response proxied by Hoverfly contains header Hoverfly: Was-Here. In this release, we are adding Hoverfly: Forwarded to it if a request is not simulated but forwarded to the remote service in SPY mode.

hoverfly -

Published by tommysitu over 5 years ago

A new helper method for response templating

We have added a new helper method for string find and replace:

{{ replace string oldValue newValue }}

For example, you can solve the problem in issue https://github.com/SpectoLabs/hoverfly/issues/841 with this templating function which replaces all occurrences of "_token" in the query params with an empty string.

{{ replace Request.QueryParam.access_token.[0] "_token" "" }}

Support multiple simulation imports through hoverctl

You can now import multiple simulations when you start hoverfly using hoverctl :

hoverctl start --import foo.json --import bar.json

This is equivalent to the following hoverfly command:

hoverfly -import foo.json -import bar.json

You can also add additional simulations after hoverfly is started:

hoverctl simulation add foo.json bar.json

Bug fixes

This release also fixes the following bugs:

hoverfly -

Published by tommysitu over 5 years ago

After the previous two RC versions, we are so excited to finally release Hoverfly v1.0.0. We really appreciate all the contributions and feedback from the community!

Partial JSON matching

A big thanks to @dilitvinov, a new matcher (jsonPartial) is available to let you partially match a JSON document. You can find out more here here.

Simulate and capture HTTP response trailers

Some APIs use HTTP response trailers, and we have implemented a solution to capture them as normal headers:

"response" : {
    "headers" : {
           "Trailer": ["X-Streaming-Error"],
           "X-Streaming-Error" : [ "Connection Closed" ]
     }
}

Kubernetes deployment using Helm

Hoverfly Helm chart has been accepted into the official Helm incubator repository.

You can simply run the following command to deploy Hoverfly into your Kubernetes cluster:

helm install incubator/hoverfly

You can find more details in the doc.

Alpine based Docker image

Thanks to @rusenask, the Hoverfly v1.0.0 Docker image will be much slimmer as it based on Alpine, and the Dockerfile uses multi-stage build.

Bug fixes

  • Thanks to @DanielJonesEB, we have fixed issues with using Go Modules and Hoverfly.
  • Goproxy dependency version is rolled back as it has a dramatic impact on HTTPS MITM performance since the release of v1.0.0-rc.1.
  • Fix security issues in Hoverfly UI.
hoverfly -

Published by tommysitu over 5 years ago

Performance improvement

This release improves performance. These improvements will save both CPU time and reduce latency, in some cases by a significant margin. Thanks to the Hoverfly community for their assistance in identifying and fixing these issues.

  • Hoverfly used to parse templates on every response whereas it now caches the parsed templates. Expect to see a significant improvement if your load tests contain large templated responses.
  • The response body is now only read to check the content length when absolutely necessary.
  • We have also introduced a fixed size LRU cache for request/response caching. Hoverfly no longer encodes and decodes the cached value saving a lot of CPU time.
  • The request/response cache is now fixed to 1000 entries by default which should remove the possibility of the cache exceeding the available memory. Its value can be configured with the following flag:
 $ hoverfly -cache-size 100

Bug fix

Fixed an issue which prevented hoverctl controlling a remote hoverfly running in a Docker container: https://github.com/SpectoLabs/hoverfly/issues/801