Getting Started

Introduction

Installation

API Client

Overview

Make an API Request

Replay request from History

Import from cURL

Inspect Traffic

Overview

Filtering Traffic

Save Session

View Request/Response Details

HTTP Rules (Modify Traffic)

Overview

Redirect URL (Map Local, Map Remote)

Replace Strings (Switch Hosts, API Endpoints)

Modify Headers

Modify Request Body

Modify Response Body

Modify Query Params

Modify Cookies

Modify DOM/Inject scripts

Modify User Agents

Modify Response Body

The Modify Response Rule allows you to mock the response body of an HTTP request.

Popular use cases

https://youtu.be/KIPbxUGUYq8

Supported resource types

Untitled

Response Rule resource types

Types of Modifications

Static Response Modification

In this mode, you can enter the response body which you want as the response.

Untitled

Response Rule - Static Body

  1. Source Condition : If the request url matches this source condition, then only the rule is applied. You can use URLHost or Path with RegexContainsWildcard or Equals to match the source request. Learn more about source conditions here.
  2. Status Code : Update the Response status code. (2XX, 3XX, 4XX, 5XX ...). If left empty, original status code is returned.
  3. Static Response Body : Define the updated response body which needs to be returned.
  4. Source Filters : This helps you define better targeting conditions and restrict rules to be applied on specific webpages (or domains), request types, request methods, or request payload. Learn more about source filters here.

Programmatic Response Modification

Programmatic Modification Script (JS) : Write a JavaScript script which can modify the existing response programmatically.

Untitled

Arguments of modifyResponse

  1. method (string)- The HTTP method of the request. GET | POST | PUT | DELETE etc.
  2. url (string) - The request URL.
  3. response (string)- The original response object represented as string. Eg:
'{"id":1,"app":"requestly","feature":"modify-request"}'

  1. responseType (string)- The content-type of the HTTP response.
  2. requestHeaders (Object<string, string>)- The request headers sent to the server.
  3. requestData (string)- The HTTP request payload in case of POST | PUT | PATCH requests.
  4. responseJSON (JSON object)- The original response represented as JSON Object:
{
  "id":1,
  "app":"requestly",
  "feature":"modify-request"
}

Return type of modifyResponse (string or JSON object)

You can modify both response or responseJSON and return any of them. Response Rule will automatically handle the response returned for the request.

Targeting GraphQL requests

You can target GraphQL requests using the operation name in request body. To do so add:

Untitled

To learn more about this checkout GraphQL Support.

Guides

FAQ