Login to start a new topic

Manual Responder?

Hi,


I would like to use the "auto responder" but in manual mode, is it possible? - as the response should contain a token present in the request, I really need to do it manually and not automatically. Is it possible to do so?


Thanksss,

David


Hello xDCrev,


You could always capture the session (in its original form) and then from the Live Traffic list, select the session, and choose "Add New Rule" via the context menu. Then you will be able to create your new custom rule for this specific session, and after a new subsequent request is made, the rule will be applied.


For example:

- Request the desired URL endpoint (e.g., httpbin.org/json)

- Select the captured session. make a right click and choose "Add new rule."

- From this point you could add the custom match rule and action - For example, you could use the EXACT to specify that the rule should be applied only to this specific endpoint, and then choose "Return manually crafted response" (or any other wanted action) to create your custom response


MATCH: EXACT:https://httpbin.org/json

ACTION: Return manually crafted response (or any other wanted action)


Save and enable the Auto Responder and re-issue your request, and you are good to go.


Thanks but how would you do if you want to change the receive response because it contains some fields I can't predict - token/sessionId etc.?


Are we talking about consecutive requests (e.g., A request returns a specific response to be used from B request)? If that is the case, I guess you could still do it by manually getting the A response and making the rule based on the received content. If that is not the case, could you please illustrate your case by providing a specific example.

Example:


myapp ----- sending request ----> server  


packet content in json format: {"session_id": "123456",   "purpose":"give me valid tokens for each thirdparties I use"}


server ---- sending response ----> myapp


packet content in json format: {"ok", "token_AAA":"12324614232", "token_BBB":....., "token_ZZZ": .....}


>> My goal << : drop the token_AAA (key and value) from the response


Can I do that? 


Thanks

It looks like you should create your custom response while using the example I've provided. Make the MATCH rule so that it triggers when you receive the server response and then make an entirely custom response while using ACTION with "Return manually crafted response". However, this would only allow you to change the response with a pre-defined one. So if you are aware of your JSON key, you could entirely mock the response. If the token expiration time is not too low, you could still make the original request - get the values you need - and provide the custom rule. 


For example a request to  https://httpbin.org/json  usually returns 


{
  "slideshow": {
    "author": "Yours Truly", 
    "date": "date of publication", 
    "slides": [
      {
        "title": "Wake up to WonderWidgets!", 
        "type": "all"
      }, 
      {
        "items": [
          "Why <em>WonderWidgets</em> are great", 
          "Who <em>buys</em> WonderWidgets"
        ], 
        "title": "Overview", 
        "type": "all"
      }
    ], 
    "title": "Sample Slide Show"
  }
}



So now let asume we wont to drop the author key-value and store the other key-values. Make the auto responder rule with "Return manually crafted response" and paste the wanted content


HTTP/1.1 200 OK
Date: Mon, 31 Aug 2020 09:35:04 GMT
Content-Type: application/json
Content-Length: 449
Connection: keep-alive
Server: gunicorn/19.9.0
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true

{
  "slideshow": {
    "date": "date of publication", 
    "slides": [
      {
        "title": "Wake up to WonderWidgets!", 
        "type": "all"
      }, 
      {
        "items": [
          "Why <em>WonderWidgets</em> are great", 
          "Who <em>buys</em> WonderWidgets"
        ], 
        "title": "Overview", 
        "type": "all"
      }
    ], 
    "title": "Sample Slide Show"
  }
}



So now when you make new request to httpbin/org/json you will receive the above response

FYI: The team is also planning on introducing breakpoints that will allow you to handle similar cases manually on-the-fly. With this functionality, you will be able to place a breakpoint and change the content dynamically and then proceed with the ongoing session. The feature is in the early stage (research), and so far, there is no date for its implementation - I will update this topic once we have more information on that one.

Login to start a new topic