Skip to content

Latest commit

 

History

History
42 lines (23 loc) · 1.88 KB

postserveaction.rst

File metadata and controls

42 lines (23 loc) · 1.88 KB

Post Serve Action

Overview

  • PostServeAction allows you to execute custom code or invoke endpoint with request-response pair after a response has been served in simulate or spy mode.
  • It is custom script that can be written in any language. Hoverfly has the ability to invoke a script or binary file on a host operating system or on the remote host. Custom code is executed/remote host is invoked after a provided delay(in ms) once simulated response is served.
  • We can register multiple post serve actions.
  • In order to register local 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.
  • In order to register remote post serve action, it takes mainly three parameters - remote host to be invoked with request-response pair, 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.
  • Via PUT API to register new post serve action as mentioned in the API page.
  • Using command line hoverctl post-serve-action set command as mentioned in the hoverctl command page.
  • 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

{
    "response": {
        "postServeAction": "<name of post serve action we want to invoke>"
    }
}