Skip to content

ExpediaGroup/network-plugin

Repository files navigation

Network Plugin

The Network plugin allows developers to proxy requests and view the request and responses in IntelliJ.

The proxy can be configured to run on any port.

Usage

Following the installation of the Network Plugin a new tool window is available named Network. It can be found on the bottom toolbar.

In the Network tool window four buttons are available:

  • Play / Start - Start the proxy server
  • Stop - Stop the proxy server
  • Bin - Clear the current visible requests
  • Settings - Set the port for the proxy server

The Network tool window has two panels, one for the visible requests & responses and another for viewing the details of the selected request.

The request response panel has the columns

  • URL - The request URL
  • Status - The response status
  • Type - The Content-Type of the response
  • Time - Response time in ms.
  • Method - The HTTP Method

The details panel has the columns

  • Request Headers
  • Request Content
  • Response Headers
  • Response Content
  • Curl Request - Reconstructed curl request

Usage with an application

To use the proxy with an application a few startup parameters need to be set. These are standard JVM startup parameters.

When using with a JVM please configure:

  • http.proxyHost
  • http.proxyPort
  • http.nonProxyHosts

For example:

java -jar my-application.jar -Dhttp.proxyHost=localhost -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts=

Note:

Not all HTTP clients respect the JVM proxy startup parameters by default.

The popular Apache HttpCient library, on which many clients are based, does not respect the JVM proxy arguments by default.

When using an Apache HttpClient, or derivative, construct the HttpClient similar to the below:

HttpClientBuilder.create()
  .useSystemProperties()
  ...
  .build()

Note:

This proxy will only work for HTTP based requests. HTTPS does not allow using a proxy in this manner.

Screenshots

A sample request headers view:
Request headers

A sample request content view:
Request content

A sample response headers view:
Response headers

A sample response content view:
Response content

A sample curl request view:
Curl request

The proxy preferences dialog:
Preferences

Building

Through IntelliJ

  1. Install the Gradle plugin
  2. Clone this repository locally
  3. File -> New -> Project from Existing Sources... -> build.gradle (from within the network-plugin folder)
  4. Change the project SDK to the bundled IntelliJ SDK

Through the command line

  1. git clone https://github.com/HotelsDotCom/network-plugin.git
  2. cd network-plugin
  3. ./gradlew clean build

Running

Through IntelliJ (assuming the application has been setup for building through IntelliJ)

  1. Run -> Edit Configurations... -> Plus Symbol -> Grade -> Select network-plugin as the Gradle project and enter runIde as the task

Installing

  1. Preferences -> Plugins -> Install plugin from disk... -> Select the zip file created by building the Network plugin

The built zip file can be found in the build/distributions folder

Acknowledgments

  1. LZ4
  2. Little proxy

About

The Network plugin allows developers to proxy requests and view the request and responses in IntelliJ.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages