Proxyman
HomepageDownload
  • Overview
  • Changelog
  • License
  • License Manager
  • Raycast
  • Command-line
  • Security Compliance
  • Proxyman iOS
    • Proxyman for iOS
    • Map Local for iOS
    • Breakpoint for iOS
    • Tutorial for iOS
      • Map Local for iOS Tutorial
      • Breakpoint for iOS Tutorial
  • Debug on Devices
    • macOS
    • iOS Device
    • iOS Simulator
    • tvOS & watchOS
    • Android Device & Emulator
      • Automatic Script for Android Emulator
      • Sample Android Project
    • Firefox
    • Java VMs
    • Python
    • Ruby
    • NodeJS
    • Rust
    • Golang
    • React Native
    • Flutter
    • HTTP Clients
    • Docker
    • ElectronJS
    • NextJS (fetch)
  • Automatic Setup
    • Automatic Setup
    • Manual Setup
    • Troubleshooting
  • Atlantis
    • Atlantis for iOS
  • BASIC FEATURES
    • Proxyman Proxy Helper Tool
    • Request / Response Previewer
    • SSL Proxying
    • Bypass Proxy List
    • Import / Export
    • Content Filter
    • Multiple Tabs
    • Horizontal/Vertical/Window Layout
    • Copy as
    • Custom Previewer Tab
    • Custom Header Column
    • Regex (Regular Expression)
    • Filter JSON Response
    • Highlight by Color and Add Comment
    • Import / Export Settings
    • Multipart Form-Data Previewer
    • JSONPath
    • Customize Toolbar
    • Localization
    • Quick Preview
  • ADVANCED FEATURES
    • Repeat
    • Edit & Repeat
    • Compose new Request
    • No Caching
    • Breakpoint
    • Breakpoint Templates
    • Map Local (File)
    • Map Local (Directory)
    • Map Remote
    • External Proxy
    • Save Session
    • Protobuf
    • WebSocket
    • Clear Session
    • Block List
    • Allow List
    • Charles Proxy Converter
    • Custom Certificates
    • GraphQL
    • Network Conditions
    • Multiple Filters
    • Custom Filters
    • Publish to Gist
    • Reverse Proxy
    • Code Generator
    • Diff
    • Access Control
    • DNS Spoofing
    • SOCKS Proxy
    • Swagger OpenAPI
    • TLS Key Logging
  • Proxyman Windows
    • Install Certificate
    • WSL
  • Scripting
    • Scripting
    • async/await Request
    • Addons
    • Built-in JS Libraries
    • Write your own Addons
    • Snippet Code
    • Environment Variables
  • Troubleshooting
    • Proxyman does not work with VPN apps
    • My Remote Devices (iOS/Android) could not connect to Proxyman?
    • iOS 16 and iOS 17 issues
    • SSL Error from HTTPS Request/Response
    • I could not see any requests from my localhost server
    • I could not see any HTTP traffic from my NodeJS, Python, or Ruby scripts
    • *.local requests do not appear on Proxyman
    • I couldn't see any traffics on Proxyman
    • I couldn't see any requests from 3rd-party network libraries
    • [Breakpoint] Modify Request/Response by Raw Message
    • Could not change Proxyman App Icons
    • Lost data after updating Proxyman app?
    • Proxyman consumes too much RAM & unresponsive
Powered by GitBook
On this page
  • 1. Use Debugging Tools with GraphQL Requests
  • 2. GraphQL Prettier
  • 3. Show GraphQL Query Name on the main table view
  • 4. Debug GraphQL Requests (Legacy - Proxyman 2.26.0 and below)
  • Map Local with the Scripting Tool
  • Manipulate Headers, Query, Body
  1. ADVANCED FEATURES

GraphQL

Capture GraphQL HTTP Request with Proxyman

PreviousCustom CertificatesNextNetwork Conditions

Last updated 7 months ago

1. Use Debugging Tools with GraphQL Requests

From Proxyman 2.27.0, we can use debugging tools with GraphQL Requests by specifying the GraphQL Query Name.

Matching by GraphQL QueryName works with Breakpoint, Map Local, Map Remote, Block List, Allow List, and the Scripting Tool.

How to use

  1. Open the debugging tool (e.g. Breakpoint)

  2. Create new Rule

  3. Click on Use "Wildcard Dropdown" -> Advanced -> Check GraphQL QueryName.

  4. Enter the GraphQL QueryName

By doing this way, the debugging tool will match the original matching rule firstly, then match the GraphQL QueryName.

From build 3.0.0, Proxyman automatically fills the GraphQL Query Name when we create a debugging tool rule.

2. GraphQL Prettier

From Proxyman 2.33.0, Proxyman can prettify/beautify GraphQL's Query Value. To do it, please open Tools Menu -> Custom Previewer Tab -> Check GraphQL checkbox.

3. Show GraphQL Query Name on the main table view

It's possible to extract and display the Query Name. Please Right-click on the Column Header and enable it.

4. Debug GraphQL Requests (Legacy - Proxyman 2.26.0 and below)

GraphQL uses the same URL to query different responses from the server, current debugging tools (e.g. Map Local, Breakpoint, Map Remote) doesn't work well.

However, by using the Scripting Tool, we can easily achieve:

  • Map Local for the response depends on QueryName

  • Manipulate the query, body, header for GraphQL Requests and Response

Map Local with the Scripting Tool

We can use the Scripting tool to map

  1. Open Proxyman

  2. Enable SSL Proxying on the GraphQL domain

  3. Verify that you can see HTTPS requests from your domain

  4. Right-Click on the flow -> Tool -> Scripting to create a script with the given URL

  5. To import a local file: Click the More button -> Import JSON or Other files -> Then selecting your file

  6. Use the following script shows you how to set a Local File to a GraphQL request with QueryName="user"

// Import file from More Button -> Import JSON or Other files 
const file = require("@users/B02D96D5.default_message_32E64A5B.json");

function onRequest(context, url, request) {

  // 1. Extract the queryName from the request
  var queryName = request.body.query.match(/\S+/gi)[1].split('(').shift();
  
  // Or extract the operationName
  var operationName = request.body.operationName
  
  // 2. Save to sharedState
  sharedState.queryName = queryName
  sharedState.operationName = operationName
  
  // Done
  return request;
}

function onResponse(context, url, request, response) {

  // 3. Check if it's the request we need to map
  if (sharedState.queryName == "user") {
    
    // 4. Import the local file by Action Button -> Import
    // Get the local JSON file and set it as a body (like Map Local)
    response.headers["Content-Type"] = "application/json";
    response.body = file;
  }

  // Done
  return response;
}

Manipulate Headers, Query, Body

  1. Use the same code and change the queryName

Please use to change the values

Custom Header Column
Enable GraphQL QueryName
Specify the GraphQL QueryName
Beautify GraphQL Query
Query Name from GrapQL Request
the snipped code