From 60ee22418bc4bad4e24b9c9c4fad4a5a25fd0162 Mon Sep 17 00:00:00 2001 From: Tommy Situ Date: Tue, 26 Sep 2023 21:26:35 +0100 Subject: [PATCH] Fix warnings in the doc --- docs/pages/keyconcepts/modes/diff.rst | 6 +++--- docs/pages/keyconcepts/postserveaction.rst | 11 +++++------ docs/pages/keyconcepts/simulations/pairs.rst | 2 +- .../keyconcepts/templating/templating.rst | 2 +- docs/pages/reference/api/api.rst | 8 ++++---- .../reference/hoverfly/request_matchers.rst | 11 +++++------ docs/pages/troubleshooting/troubleshooting.rst | 18 +++++++++--------- .../basic/delays/lognormal/lognormal.rst | 1 + 8 files changed, 29 insertions(+), 30 deletions(-) diff --git a/docs/pages/keyconcepts/modes/diff.rst b/docs/pages/keyconcepts/modes/diff.rst index 475e1b2d8..43b497307 100644 --- a/docs/pages/keyconcepts/modes/diff.rst +++ b/docs/pages/keyconcepts/modes/diff.rst @@ -1,10 +1,10 @@ .. _diff_mode: Diff mode -======== +========= In this mode, Hoverfly forwards a request to an external service and compares a response with currently stored simulation. -With both the stored simulation response and the real response from the external service, Hoverfly is able to detect +With both the stored simulation response and the real response from the external service, Hoverfly is able to detect differences between the two. When Hoverfly has finished comparing the two responses, the difference is stored and the incoming request is served the real response from the external service. @@ -48,4 +48,4 @@ This data is stored and kept until the Hoverfly instance is stopped or the the s .. seealso:: - For more information on the API to retrieve differences, see :ref:`rest_api`. \ No newline at end of file + For more information on the API to retrieve differences, see :ref:`rest_api`. diff --git a/docs/pages/keyconcepts/postserveaction.rst b/docs/pages/keyconcepts/postserveaction.rst index 209b17598..69449888f 100644 --- a/docs/pages/keyconcepts/postserveaction.rst +++ b/docs/pages/keyconcepts/postserveaction.rst @@ -4,7 +4,7 @@ Post Serve Action ================= Overview -======== +-------- - PostServeAction allows you to execute custom code after a response has been served in simulate or spy mode. @@ -15,7 +15,7 @@ Overview - In order to register post serve action, it takes mainly four parameters - binary to invoke script, script content/location, delay(in ms) post which it will be executed and name of that action. Ways to register a Post Serve Action -================================== +------------------------------------ - At time of startup by passing single/multiple -post-serve-action flag(s) as mentioned in the `hoverfly command page `_. @@ -27,13 +27,12 @@ Ways to register a Post Serve Action - Once post serve action is registered, we can trigger particular post serve action by putting it in response part of request-response pair in simulation JSON. **Example Simulation JSON** -:: + +.. code:: json + { - ... "response": { - ... "postServeAction": "" - ... } } diff --git a/docs/pages/keyconcepts/simulations/pairs.rst b/docs/pages/keyconcepts/simulations/pairs.rst index badb8c8e3..02a3833e0 100644 --- a/docs/pages/keyconcepts/simulations/pairs.rst +++ b/docs/pages/keyconcepts/simulations/pairs.rst @@ -140,7 +140,7 @@ JSON is a text-based file format so it has no intrinsic support for binary data. :ref:`View entire simulation file ` Serving response bodies from files -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Starting from version **1.3.0** hoverfly can return response body from a specific file: diff --git a/docs/pages/keyconcepts/templating/templating.rst b/docs/pages/keyconcepts/templating/templating.rst index 130d692db..ffae1ca2c 100644 --- a/docs/pages/keyconcepts/templating/templating.rst +++ b/docs/pages/keyconcepts/templating/templating.rst @@ -86,7 +86,7 @@ Additional data can come from helper methods. These are the ones Hoverfly curren | | ``'be' 'mock' }}`` | | | value in the target string | (where Request.Body has the value of | | | | | | -| | {"text":"to be or not to be"} | to mock or not to mock | +| | ``{"text":"to be or not to be"}`` | to mock or not to mock | +-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------+ | Generate random data using go-fakeit | ``{{ faker 'Name' }}`` | John Smith | +-----------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------+ diff --git a/docs/pages/reference/api/api.rst b/docs/pages/reference/api/api.rst index 037c4141e..b1241b863 100644 --- a/docs/pages/reference/api/api.rst +++ b/docs/pages/reference/api/api.rst @@ -677,7 +677,7 @@ Sets the PAC file for Hoverfly. DELETE /api/v2/hoverfly/pac -"""""""""""""""""""""""" +""""""""""""""""""""""""""" Unsets the PAC file configured for Hoverfly. @@ -685,7 +685,7 @@ Unsets the PAC file configured for Hoverfly. GET /api/v2/cache -"""""""""""""""""""" +""""""""""""""""" Gets the requests and responses stored in the cache. **Example response body** @@ -986,9 +986,9 @@ Gets reports containing response differences from Hoverfly filtered on basis of ------------------------------------------------------------------------------------------------------------- DELETE /api/v2/diff -"""""""""""""""""""" +""""""""""""""""""" Deletes all reports containing differences from Hoverfly. DELETE /api/v2/shutdown -"""""""""""""""""""" +""""""""""""""""""""""" Shuts down the hoverfly instance. diff --git a/docs/pages/reference/hoverfly/request_matchers.rst b/docs/pages/reference/hoverfly/request_matchers.rst index 521ac28cd..23ce908ab 100644 --- a/docs/pages/reference/hoverfly/request_matchers.rst +++ b/docs/pages/reference/hoverfly/request_matchers.rst @@ -559,9 +559,9 @@ Example "matcher": "array", "config": { - "ignoreUnknown": , - "ignoreOrder": , - "ignoreOccurrences": + "ignoreUnknown": "", + "ignoreOrder": "", + "ignoreOccurrences": "" }, "value": [ "access:vod", @@ -601,7 +601,6 @@ Example "matcher": "jsonpath", "value": "$.user.id", "doMatch": { - matcher: "exact", - value: "1" + "matcher": "exact", + "value": "1" } - diff --git a/docs/pages/troubleshooting/troubleshooting.rst b/docs/pages/troubleshooting/troubleshooting.rst index 6a51954c2..7368fdedf 100644 --- a/docs/pages/troubleshooting/troubleshooting.rst +++ b/docs/pages/troubleshooting/troubleshooting.rst @@ -71,14 +71,14 @@ When Hoverfly cannot match a response to an incoming request, it will return inf "headers": null }` -Here, you can see which fields did not match. In this case, it was the ``body``. +Here, you can see which fields did not match. In this case, it was the ``body``. You can also view this information by running ``hoverctl logs``. Why isn't Hoverfly returning the closest match when it cannot match a request? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Hoverfly will only provide this information when the matching strategy is set to **strongest match** -(the default). If you are using the **first match** matching strategy, the closet match information +Hoverfly will only provide this information when the matching strategy is set to **strongest match** +(the default). If you are using the **first match** matching strategy, the closet match information will not be returned. How can I view the Hoverfly logs? @@ -90,9 +90,9 @@ How can I view the Hoverfly logs? Why does my simulation have a ``deprecatedQuery`` field? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Older simulations that have been upgraded through newer versions of Hoverfly may now contain a field +Older simulations that have been upgraded through newer versions of Hoverfly may now contain a field on requests called ``deprecatedQuery``. With the v5 simulation schema, the request query field was updated to more fully represent request query paramters. This involves storing queries based on query keys, similarly to how headers are stored in a simulation. @@ -124,14 +124,14 @@ If you have ``deprecatedQuery`` field, you should remove it by splitting it by q ], } -If you cannot update your ``deprecatedQuery`` from your simulation for a technical reason, feel free to +If you cannot update your ``deprecatedQuery`` from your simulation for a technical reason, feel free to raise an issue on Hoverfly. Why am I not able to access my Hoverfly remotely? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -That's because Hoverfly is bind to loopback interface by default, meaning that you can only access -to it on localhost. To access it remotely, you can specify the IP address it listens on. For example, +That's because Hoverfly is bind to loopback interface by default, meaning that you can only access +to it on localhost. To access it remotely, you can specify the IP address it listens on. For example, setting ``0.0.0.0`` to listen on all network interfaces. .. code:: bash @@ -139,7 +139,7 @@ setting ``0.0.0.0`` to listen on all network interfaces. hoverfly -listen-on-host 0.0.0.0 My simulation file is very large because of response bodies, what can I do with that? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can move those response bodies into separate files and specify :code:`bodyFile` in the response instead of :code:`body`. Please refer to :ref:`pairs`. diff --git a/docs/pages/tutorials/basic/delays/lognormal/lognormal.rst b/docs/pages/tutorials/basic/delays/lognormal/lognormal.rst index 2ed15fa37..68065910f 100644 --- a/docs/pages/tutorials/basic/delays/lognormal/lognormal.rst +++ b/docs/pages/tutorials/basic/delays/lognormal/lognormal.rst @@ -11,6 +11,7 @@ If need you can adjust response time by min and max parameters. .. _Log-normal distribution: https://en.wikipedia.org/wiki/Log-normal_distribution .. _mean: https://en.wikipedia.org/wiki/Expected_value .. _median: https://en.wikipedia.org/wiki/Median + Let's apply a random log-normal distributed delay to all responses. First, we need to create and export a simulation. .. literalinclude:: delays-capture.sh